Support » Plugin: Lazy Loader » $lazy_loader instance not available

  • Resolved zitrusblau

    (@zitrusblau)


    Hey Florian,

    I was wondering what might go on here:
    As stated in the readme, I tried to check for the existence of the lazy_loader instance with

        if ( isset( $lazy_loader ) && $lazy_loader instanceof FlorianBrinkmann\LazyLoadResponsiveImages\Plugin ) {
          $image = $lazy_loader->filter_markup( wp_get_attachment_image( $image_id );
        }

    but the lazy_loader instance is not available globally. I added this code in a template-part, so nothing special about it and the plugin is active of course.

    Plugin Version: latest
    WP 5.2.4

    • This topic was modified 2 years ago by zitrusblau. Reason: typo
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    Hey @zitrusblau,

    could you try to add a global $lazy_loader; before the if statement and check if that helps?

    Best,
    Florian

    Thread Starter zitrusblau

    (@zitrusblau)

    oh…of course, you’re right! 🙂

    that made the instance available.
    thanks!

    Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    You’re welcome, great to hear that it’s working 🙂

    I will add this to the code example in the readme.

    Best,
    Florian

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘$lazy_loader instance not available’ is closed to new replies.