Home › Forums › Pro Support › Image Size
- This topic has 5 replies, 2 voices, and was last updated 2 years, 3 months ago by
elvin.
-
AuthorPosts
-
May 20, 2021 at 2:47 am #30402
Sam
ParticipantHi
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
May 20, 2021 at 4:41 am #30411elvin
ModeratorHi 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#L193But 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'; } );
May 22, 2021 at 4:24 am #30484Sam
ParticipantThanks 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)
May 23, 2021 at 5:39 pm #30531elvin
ModeratorIs 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. 😀
May 27, 2021 at 2:19 am #30672Sam
ParticipantElvin – 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
May 31, 2021 at 12:24 am #30740elvin
ModeratorI 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; }
-
AuthorPosts
- You must be logged in to reply to this topic.