Archived topic
Image size of pinned post on Blog
3 replies · Started by Kristian on May 3, 2020
How to set the size of the pinned post featured image on blog roll? It changes with all the other featured images making it a lot smaller. I'd like it to be as wide as the container.
Thanks,
Kristian
Hi there,
It may be possible, but you'll need to use the Media Attachment Size option in the Customizer instead of the custom width/height controls.
First, I would create two new image sizes - one for the main posts and one for the featured post: https://docs.generatepress.com/article/adding-image-sizes/
After you add them, regenerate your thumbnails and set your Media Attachment Size option to the size for your main posts: https://docs.generatepress.com/article/adjusting-the-featured-images/
Then, you might be able to do this:
add_filter( 'generate_page_header_default_size', function( $size ) {
$classes = get_post_class();
if ( in_array( 'featured-column', $classes ) ) {
return 'your-featured-image-size-name';
}
return $size;
}, 20 );
Worked perfectly, thank you so much!
You're welcome :)