[Resolved] Feature post + 2 columns + specific image sizes

Home Forums Support [Resolved] Feature post + 2 columns + specific image sizes

Home Forums Support Feature post + 2 columns + specific image sizes

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #534860
    Gabriel Giner

    Hello, I would like to have a featured image on archives, then 2 columns of posts.

    If I don’t set a specific image size, the two columns use the original image sizes, which is not really optimal for speed load and also the images are so different it doesn’t look really good.

    If I set a specific image size, let’s say 360×200, the featured image takes also that size.

    Can we set an image size just for the posts on columns, and leave the featured image on its original size as this one should take the whole width?

    Thank you in advance,
    Gabriel

    #534862
    Gabriel Giner

    .generate-columns-container .featured-column {
    float: none;
    width: 100%;
    }

    that doesn’t work for me

    #535345
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    We could try something like this:

    add_filter( 'generate_blog_image_attributes', 'tu_featured_column_image' );
    function tu_featured_column_image( $atts ) {
        // Set up our conditional
        if ( ! is_singular() && in_array( 'featured-column', get_post_class() ) ) {
            $atts[ 'width' ] = 500;
            $atts[ 'height' ] = 300;
            $atts[ 'crop' ] = true;
        }
    
        // Return our options
        return $atts;
    }
    #538450
    Gabriel Giner

    Working perfectly. Thank you very much!!

    #538721
    Tom
    Lead Developer
    Lead Developer
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.