Home › Forums › Pro Support › WPSP & Imagify
Tagged: Imagify with option
- This topic has 5 replies, 2 voices, and was last updated 2 years ago by
Tom.
-
AuthorPosts
-
May 7, 2020 at 10:59 am #15385
David
ParticipantHi,
I recently noticed that not all images on my site are showing with the <picture> tag around them.
The images from my theme GP Premium work fine, but the images from WPSP do not have the <picture> tag around them.
I use WP Rocket and Imagify. The Imagify option to display the <picture> is used.I made a short 4 minute video explains this.
Thank you for your time.
May 7, 2020 at 3:42 pm #15392Tom
KeymasterHi there,
This is likely due to how WPSP resizes images.
Instead of using the built-in image resizing options, I would do this: https://wpshowposts.com/support/topic/show-posts-images-not-working/#post-8324
May 7, 2020 at 10:22 pm #15398David
ParticipantHi Tom,
We definitely made progress on this.
This filter works great for 5 of the 8 WPSP grids I’m using. By this I mean, if I do not specify an image size in WPSP, then the image is served with the <picture> tag as expected.
However, I still have 3 WPSP grids do not use the default image size.
This filter only sets the default size, and so anytime I set the size in WPSP it does not use the <picture> tag.
May 8, 2020 at 4:17 pm #15416Tom
KeymasterWhat do you mean by “set the size in WPSP”? Are you using the width/height controls for those lists?
May 9, 2020 at 6:47 am #15424David
ParticipantHi Tom,
I don’t understand you question.
But it’s okay I made a very short video explaining the issue I’m having.
Thank you very much, David
May 12, 2020 at 4:48 pm #15498Tom
KeymasterHi David,
That makes sense, as our resizer kicks into gear when you specify custom image sizes in the list. That image resizer typically won’t work with plugins like filter the output of normal featured images, which are output when no custom sizes are added.
This is a tricky issue as of right now, as there’s no way to target individual lists with that filter.
However, you can see in the next version we’ve added a
$settings
variable to the filter: https://github.com/tomusborne/wp-show-posts/blob/release/1.2/inc/functions.php#L193So if you make that change to your current version, you’d be able to do this:
add_filter( 'wpsp_default_image_size', function( $size, $settings ) { if ( 123 === $settings['list_id'] ) { return 'size-for-123-list'; } if ( 456 === $settings['list_id'] ) { return 'size-for-456-list'; } return 'medium'; // Size for everything else. }, 10, 2 );
Let me know if you need more info 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.