Support » Plugin: SrcSet Responsive Images for WordPress » SrcSet group's attribute scope

  • Could SrcSet group’s attribute be applied to images utilized by other plugins, like Metaslider for example?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Eric Holmes


    Hi Spinaker,

    I don’t have any experience with using MetaSlider, but it looks like they surface their image tag attributes with the metaslider_{type}_image_attributes filter. You can generate the srcset value attribute by using TNSrcSet::get_image_srcset( $attachment_id, $size );. Example usage may be something like the following:

    add_filter( 'metaslider_flex_slider_image_attributes', 'spinaker_metaslider_srcset_attribute', 10, 3 );
    function spinaker_metaslider_srcset_attribute( $attributes, $slide, $slider_id ) {
        // $attachment_id and $size will need to be replaced by your own data
        $attributes['srcset'] = TNSrcSet::get_image_srcset( $attachment_id, $size );
        return $attributes;

    That’s great Eric. Thank you for your response.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘SrcSet group's attribute scope’ is closed to new replies.