🎉 Happy 4th of July! Get 15% off GP Premium with the discount code: 4THOFJULY2020

[Support request] Set post thumbnail size on blog

Home Forums Support Set post thumbnail size on blog

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1174801
    Dan

    Hello
    I have the blog layout in my homepage.
    It’s displaying the featured image.
    The problem is that it’s taking a very large image, 2000X1500px for example, and reducing the width to 370X270.
    Still, the file loaded is the large one, taking up a lot of loading time.
    Is there a setting so that the theme takes the medium sized thumbnail and not the large or full size for the blog archive layout? at least when the display in the archive is 2 or 3 columns?
    Something inline with the function the_post_thumbnail('medium')

    Thanks
    Dan

    #1174811
    Dan

    I added this filter, but I don’t see any change:

    add_filter( 'generate_blog_image_attributes','tu_variable_image_sizes' );
    function tu_variable_image_sizes( $atts ) {
        // Set up our conditional
        if ( is_front_page() ) {
            $atts[ 'width' ] = 400;
            $atts[ 'height' ] = 400;
            $atts[ 'crop' ] = true;
        }
    
        // Return our options
        return $atts;
    }
    #1175473
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Try this:

    add_filter( 'generate_page_header_default_size', function( $size ) {
        if ( ! is_singular() ) {
            return 'medium';
        }
    
        return $size;
    } );

    Let me know 🙂

    #1175481
    Dan

    Hi Tom, Thanks.
    Since I’m using the ‘sider’ site, what would be the best practice in creating a child theme for that site – so I can edit the functions.php file?
    Or would I add it via Elements?

    Thanks
    Dan

    #1175487
    Tom
    Lead Developer
    Lead Developer

    You can use this plugin if you’re not using a child theme: https://wordpress.org/plugins/code-snippets/

    You can also use a child theme like you normally would, regardless of using the Site Library 🙂

    #1175503
    Dan

    OK, got it sorted out, exported the customizer settings (with this: https://wordpress.org/plugins/customizer-export-import/), created the child theme and then imported the customizer settings.
    Shouldn’t the theme set a thumbnail size (medium/large) to the blog posts featured images by default? This could save some serious bandwidth and loading speeds.

    Another question related to the blog archive – when setting the infinite scroll, is there a way to add a spinner or loading icon to display to the users while the other posts are loading?

    Thanks
    Dan

    #1175814
    Tom
    Lead Developer
    Lead Developer

    We actually do have options to resize your featured images, but we’re removing them in 1.10 in favor of the standard WP way of doing things.

    As for the spinner, this might help: https://generatepress.com/forums/topic/adding-a-loading-spinner-to-infinite-scroll/#post-929728

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