Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Image size for featured column in blog page

  • Hi,

    I’ve set up the blog page (posts archive) to display in 3 columns, with the first article styled as “featured.”

    Under “Customizer > Layout > Blog > Media Attachment Size”, I’ve set the “medium” size, which works well for the articles in columns. However, I’d like to use a larger image size specifically for the featured column, as it’s set to 100% width in CSS.

    Is there a way to adjust the media size only for that featured article?

  • Yes, try this PHP code:

    add_filter( 'generate_page_header_default_size', function( $size ) {
        $classes = get_post_class();
    
        if ( in_array( 'featured-column', $classes ) ) {
            return 'full'; //change full to the size you want to use
        }
    
        return $size;
    }, 20 );

    Adding PHP: https://docs.generatepress.com/article/adding-php/

  • Hi Ying,

    Sorry, I just realized that I never replied to this thread.

    The solution you suggested works perfectly, thank you.

  • Glad to hear that 🙂

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