• Resolved totaltec

    (@totaltec)


    Hi, thanks for a fantastic theme.

    We updated https://jadango.com/ to 4.4 this morning. Now the slides look blurry. Chrome is deciding to use the 1024px version of the slide. This is due to WP’s new srcset for responsive images. I can remove the srcset behavior easily from the_content and the_excerpt like so:
    remove_filter( 'the_content', 'wp_make_content_images_responsive' );

    Any tips on how I can remove it from the slider? Or make the slider images display the right size?

    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello.
    You might want to add the following code to your child-theme functions.php in order to “avoid” responsive images in the sliders.

    add_filter('tc_the_slides', 'disable_slider_responsive_images');
    add_filter('tc_the_posts_slides', 'disable_slider_responsive_images');
    function disable_slider_responsive_images( $slides ) {
      foreach ( $slides as &$slide ) {
        $slide['slide_background'] = preg_replace( array( '#srcset=".*?"#', '#sizes=".*?"#' ), array('',''), $slide['slide_background'] );
      }
      return $slides;
    }

    Does this help?

    Thread Starter totaltec

    (@totaltec)

    Wow, Thanks so much. I rarely ask for help and I really appreciate this tidbit. Thanks man.

    Glad you solved, you’re welcome ??
    Would you mind marking this topic as resolved?

    Thanks ??

    Thread Starter totaltec

    (@totaltec)

    Resolved. Thanks again.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove srcset from slider images WP’ is closed to new replies.