Archived topic
Generating post thumbnails
9 replies · Started by Halil on August 31, 2021
hi,
I've deliberately disabled all custom media sizes in my blog by using a plugin called "stop generating unnecessary thumbnails".
I'm also using conditional disqus load plugin, which tries to show some sort of post thumbnails which are now available.
According to my readings, thumbail setting in media menu has nothing to do with post thumbnails. I might be wrong, not sure!
How do I generate post thumbnails then?
huge thanks
Hi there,
i can't say how the Disqus plugin works, but the standard method of displaying a thumbnail is to use the wp_get_attachment_image function
https://developer.wordpress.org/reference/functions/wp_get_attachment_image/
And one if its parameters is: $size = 'the_attachment_size'
If a thumbnails size no longer exists then its going to 404 on the image URL.
Problem is it looks like you have many different sizes of image being displayed in the Disqus posts list...
I agree, looks like it calls for many different sizes for thumbnail. Assuming that generating "post image" solves the issue, how can I generate them?
I read some php codes should be added to functions php but I have no idea for any GP specific code.
Does it work when you DON'T disabled all custom media sizes ?
I am afraid of trying this : ) I cant handle multiple size of the same pics, If I disable and regenarete all sizes I end up with the old situation.
But I can test a some sort of php code if there is a way to generate post thumbnails (instead of pics)
Post thumbnails rely on the wp_get_attachment_image function, which requests the image size that is specified in that functions $sizes attribute. You could check with the Disqus plugin author if there is a filter that would allow you to set which Image Size it uses, then you could set that to a size you do have available.
I'll try that.
Do you think your answer in this thread has anything to do with this?
https://generatepress.com/forums/topic/image-size-and-resize-current-options/
the part with
add_theme_support( 'post-thumbnails' );
The theme already adds support for the post-thumbnails, you can see it here in the themes functions.php
thanks David
Speak with Disqus - see if they can filter the image size their using :)
Glad to be of help