We're merging with GenerateBlocks! Learn more here.

[Support request] Image Size

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Image Size

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #30402
    Sam
    Participant

    Hi

    I know that the beta release has a way of setting the default image size but when is this going to make it’s way into a full release?

    I know the focus has been on GP and GB – but starting to feel a little forgotten

    Is there anything I can do in the meanwhile? Ie any php code snippet?

    Thanks

    Sam

    #30411
    elvin
    Moderator

    Hi Sam,

    For now, you can try using the wpsp_default_image_size filter.

    By the default, the value is apply_filters( 'wpsp_default_image_size', 'full' )
    https://github.com/tomusborne/wp-show-posts/blob/35e410d7800273fc66f211c0f80d553e95d17f83/inc/functions.php#L193

    But you can change it to your preference. You can register a new image size and generate it for use of this filter.

    Example:

    add_filter( 'wpsp_default_image_size', function(){ return 'register_image_size_name_here'; } );

    #30484
    Sam
    Participant

    Thanks Elvin – I will spin up a staging site and give it a whirl

    I will report back later

    Is there an ETA on the new release or is GP/GB still the primary project (at the moment)

    #30531
    elvin
    Moderator

    Is there an ETA on the new release or is GP/GB still the primary project (at the moment)

    Tom’s still on GP/GB at the moment.

    But I’ll tag him here in case there’s any new development timeline change. 😀

    #30672
    Sam
    Participant

    Elvin – how can i modify that code to apply a different size to

    – A specified archive
    – Media size (ie mobile)

    I have an archive on my home page which are 3 wide (on a 1200px page) – meduim_Large

    Then i have a set of archives in the post side bar (ie other post you might like to read) – which need to be medium

    However, this same post archives then stack under the post on tablet – making them medium_large. And medium on >768px, ie mobile

    #30740
    elvin
    Moderator

    I don’t think media size change for mobile is doable.

    PHP runs server-side so it’s basically blind to what happens on the front end.

    The best bet we can do is keep the defaults but generate different media sizes by registering images of different sizes and let WordPress srcset do its intended purpose.

    What we can do is to write CSS to at least control how wide the image’s container is so the srcset goes with it.

    Example:

    @media(max-width:767px){
    .wp-show-posts-image{
    width: your width value here;
    height: your height value here;
    overflow:hidden;
    }
    
    .wp-show-posts-image img { object-fit: cover; }
    }

    For tablet stacking, we’ll basically have to force the article to go 100%.

    @media(max-width:1024px){
    .wp-show-posts-columns article{
    width: 100% !important;
    }
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.