This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Using srcset with image grids

  • Creator
  • #25383
    Robert Piller

    Hi Jason,

    Do you have plans to integrate image srcset attributes? I notice the JumpStart demo (blog, portfolio, and product grids) avoids using them, and I’m curious why.

    I ask because I’m removing show_product_image from woocommerce_before_shop_loop_item_title and replacing it with my own function that manually adds:

    themeblvd_the_post_thumbnail( themeblvd_get_att('crop'), array('placeholder' => true) );

    But this leads to an unfortunate scenario where product archives (e.g., load 1200px wide images that need only display at 353px wide (210–420px depending on screen size).

    I admit I haven’t worked much with srcsets, but from what I understand, the problem is this last bit:

    sizes="(max-width: 1200px) 100vw, 1200px"

    More sizes need to be defined. So I’m curious if you have plans to incorporate this into the theme.

    Or perhaps you know a way to get the theme to deliver a more appropriately-sized, non-cropped image (like tb_medium)? This doesn’t work:

    themeblvd_the_post_thumbnail( 'tb_medium', array('placeholder' => true) );

    Any thoughts or advice would be appreciated! Thank you.

Viewing 1 replies (of 1 total)
  • Author
  • #25385
    Jason Bobich


    Specifying the image crop size should work:

    themeblvd_the_post_thumbnail( 'tb_grid', array('placeholder' => true) );

    But if it’s specifically the WP srcset interacting and messing with that, you can try this:

    themeblvd_the_post_thumbnail( 'tb_grid', array('placeholder' => true, 'srcset' => false) );

    Also, that 1200px is based on the global content width, I believe. So, another thing you can try if the two things above don’t work is that you can change that global content width value (a default WP thing) just before you call themeblvd_the_post_thumbnail().

    $GLOBALS['content_width'] = 400;
    themeblvd_the_post_thumbnail( 'tb_grid', array('placeholder' => true) );
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.