• Resolved pclweb

    (@pclweb)


    Hi I have the latest RC1 nightly with easy digital downlaods and added the “wp_omit_loading_attr_threshold” function and set to 4 for rwemoval of lazy loading.

    It works perfectly for archive pages but not for the front page.

    The code is exactly the same in the templates for both pages.

    • This topic was modified 3 years, 2 months ago by pclweb.

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi, @pclweb:

    Are the front page images in question part of the_content or the_post_thumbnail, and also in the loop? This filter specifically targets that context.

    Thread Starter pclweb

    (@pclweb)

    Hi, yes it’s using the sames code which I have in my archive page which displays a number of products through the front-page.php template. The filter is working perfectly for that page just not the homepage.

    Looking at view source it’s outputting exactly the same code on both pages for the products but as filtered the archive page ommits the lazy code.

    This is the code i’m using in my theme.

    function skip_lazyloading_on_first_four_images( $omit_threshold ) {
        if ( is_front_page() || is_archive() ) {
            return 4;
        }
        return $omit_threshold;
    }
    add_filter( 'wp_omit_loading_attr_threshold', 'skip_lazyloading_on_first_four_images' );
    Moderator Marius L. J.

    (@clorith)

    Hiya,

    I’m unable to replicate this issue locally, could it be that your theme is defining a home page, and not a front page (in which case, you would want to use is_home() in your conditional check)?

    Thread Starter pclweb

    (@pclweb)

    Hi, I also tried using is_home() but still the same.

    I’m using Easy Digital Downloads, WP 5.9 and GeneratePress theme.

    As I stated in the previous post. I used the exact same code from the archive page to create a front-page.php and it’s only the homepage which doesn’t work with lazy omission. The store and archive pages are working correctly.

    Same problem in my theme (Presscustomizr Hueman Pro)… featured image in Home Page is ever passed with loading=”lazy”…
    In addiction, the filter
    add_filter( 'wp_lazy_loading_enabled', '__return_false' );
    I’ve had added in my child theme functions.php file has no effect, since WordPress 5.9

    @clorith @pclweb

    Same issue here. It breaks Flexslider in my themes on the homepage – disabling lazy loading doesn’t seem to work anymore.

    @donpi73 Hueman uses Flexslider, so same issue there too.

    Anyone got a fix?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Lazy loading Not Omitting On Homepage’ is closed to new replies.