Support » Plugin: BJ Lazy Load » Is this supposed to work with all images on page?

  • I have a long page of images placed via Advanced Custom Fields, should this work with those images? It doesn’t seem to but not sure if it’s because I’ve been to the page before, so would like to know before I test across different browsers, machines …etc.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author arontornberg

    (@arontornberg)

    Hi,
    The plugin uses regex to parse the html of the page and modify the images so it should work with all images. If you look at the page source in the browser and the images have the class “lazy” the plugin has detected and modified them.

    There is no class “lazy” applied to the images.

    And as I said, these are simply images uploaded via Advanced Custom Fields, and placed on the page using “wp_get_attachment_image”.

    I had the same need and I solved it by using the following code:

    // Applying the_content filter to our image markup to work with BJ Lazy Load plugin
    	$neat_responsive_image_id = get_field('responsive_image');
    	$neat_responsive_image_markup = wp_get_attachment_image( $neat_responsive_image_id, 'full', false, array( 'class' => 'your-class' ) );
    	echo apply_filters( 'the_content', $neat_responsive_image_markup );

    taken from https://jasonyingling.me/using-wordpress-responsive-images-advanced-custom-fields/

    Thanks mate, I’ll bookmark the info for next time I’m in need.

    It looks like the plugin doesn’t work well with “wp_get_attachment_image”, which is probably something to address.

    • This reply was modified 9 months, 2 weeks ago by  Dave.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Is this supposed to work with all images on page?’ is closed to new replies.