[Resolved] Image size of pinned post on Blog

Home Forums Support [Resolved] Image size of pinned post on Blog

Home Forums Support Image size of pinned post on Blog

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1267051
    Kristian

    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

    #1267748
    Tom
    Lead Developer
    Lead Developer

    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 );
    #1270344
    Kristian

    Worked perfectly, thank you so much!

    #1270931
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.