• It’s easy to add SRCSET Support by replacing

    $src = wp_get_attachment_image_src( $src, $size);
    $src = $src[0];

    with

    $src1 = wp_get_attachment_image_src( $src, $size);
    $srcset = wp_get_attachment_image_srcset( $src, $size);
    $src1 = $src1[0];

    in wpb_iw_shortcode.php.

    The image can be loaded via

    <img src="<?php echo $src1; ?>" srcset="<?php echo $srcset; ?>" sizes="50vw" alt="">

    Maybe you could create an update to fully support SRCSET? There are still a view things (like automated sizes) missing in my code…

    https://wordpress.org/plugins/wpb-image-widget/

The topic ‘Adding SRCSET Support’ is closed to new replies.