• Hi Guys,

    We have had a support ticket on which one your users @friendofmisery has posted this

    a3 Lazy Load is working everywhere on the site except the home page. Have downloaded the theme and see that images are added by this custom function which means lazy load can’t find the images

    function siteorigin_unwind_get_image() {
        $first_image = ‘’;
    
        $output = preg_match_all( ‘/<img[^>]+\>/i’, get_the_content(), $images );
        $first_image = $images[0][0];
    
        return ( ‘’ !== $first_image ) ? $first_image : false;
    }

    It is not possible for us to add custom code for every different custom function that a developer might use – but if you wished we provide filters so that a3 lazy Load can be applied to your custom functions.

    To fix the issue for your user and make your theme fully compatible with a3 lazy load would require just a small filter – if you would be willing to add it.

    for example change

    return ( ‘’ !== $first_image ) ? $first_image : false;
    to
    return ( ‘’ !== $first_image ) ? apply_filters( ‘a3_lazy_load_images’, $first_image, false ) : false;

    Just for your reference here is a full list of filters that developers can be use for a3 lazy Load compatibility – but as i mentioned it is just your home page where the issue exists.

    Apply filter tags to apply lazy load:
    – a3_lazy_load_images : apply lazy load for images from content
    Example code to use it: apply_filters( ‘a3_lazy_load_images’, $your_content, null );

    – a3_lazy_load_videos :apply lazy load for videos and iframe from content
    Example code to use it: apply_filters( ‘a3_lazy_load_videos’, $your_content, null );

    – a3_lazy_load_html : apply lazy load for all images, videos and iframe from content
    Example code to use it: apply_filters( ‘a3_lazy_load_html’, $your_content, null );

    Hard class name to exclude lazy load on images or videos , iframes from lazy load : a3-notlazy

    Filter tags for add class name of theme to exclude lazy load on images or videos :
    – a3_lazy_load_skip_images_classes
    – a3_lazy_load_skip_videos_classes

    Regards
    Steve

    • This topic was modified 6 years, 8 months ago by Steve Truman.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi! I tried as Steve suggested and it works perfectly! friendofmisery

    Thanks Steve ??

    The function in question is our handling of the “Image” post format. It’s treating the first image as it would the featured image.

    Fix will be in the next update, most likely early next week. We updated on the 26th so just need to wait a little to push another one.

    In future, if you’d like to chat directly to Alex or me about issues like this, feel free to email us on [email protected]. We’ll do our best to assist and accommodate.

    @friendofmisery, thanks for testing this and using Unwind ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Please add support for a3 lazy Load for Home Page Custom image function’ is closed to new replies.