Archived topic
Featured image parameter
22 replies · Started by Charles on January 7, 2022
Yeah the GP Blog Featured Image options only apply when the theme outputs the image. Your function is using get_the_post_thumbnail
https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/
On this line of the code:
$feat_img = get_the_post_thumbnail($post->ID, 'post-single');
If you just want to display a different size image, you can change the post-single to a different attachment size.
If its something more than that, let me know.
OK, this makes sense.
WP is creating a shit-ton of images on each upload:
https://drive.google.com/file/d/15HBafGSnIjRkNCgPK0HQH6bpRSYztAa7/view?usp=sharing
Can/should I try to prevent that? And how do I know which image is which registered image size name?
Thanks
Also which image size name does GP use for the featured image?
You may have some other plugins or functions that are adding more attachment sizes. By default the sizes with their names are:
150px* thumbnail
300px* medium
768px medium_large
1024px* large
There are other larger sizes but WP will only generate those if the original image is real big.
The ones marked with the * are those listed in the Settings > Media
By default GP will use the Full Size image BUT WP will output the src-set sizes available, so the browser can select one.
In the Blog settings you can select a specific Media Attachment size for GP to load as well as specifying specific width / height attributes.
What settings did you add to the Blog settings exactly ?
I only added "full" as the media attachment size. Is full the same as large?
In this code I don't see how 'post-single' maps onto the image size names (is 'post-single' an image size name?):
$feat_img = get_the_post_thumbnail($post->ID, 'post-single');
Would this be right?
$feat_img = get_the_post_thumbnail($post->ID, 'large');
Hi Charles,
In this code I don’t see how ‘post-single’ maps onto the image size names (is ‘post-single’ an image size name?):
Assuming you've registered an image size named post-single then yes, it should be an image size. But if you didn't it's probably a non-existing image size and won't work.
I only added “full” as the media attachment size. Is full the same as large?
It can't be but not all the time. full is the size of the innate size of the image file when you've uploaded it.
large is a scaled version of the file for the large media size specified in Admin > Settings > Media as shown here - https://share.getcloudapp.com/5zunyOeo - which by default, is set to 1024x1024.
$feat_img = get_the_post_thumbnail($post->ID, 'large');
Yes, that's how you change the size it will use. :D
Thank you.
No problem.