Support » Plugin: lazysizes » Processing markup potentially possible?

  • Jonas


    Hi Patrick

    First off thank you for making this plugin available. I’ve been looking all over for a WP lazyloading plugin which also generates placeholders since I’m finding that the lazy loading UX can otherwise be too disruptive.

    And when your plugin works it does so really well. Unfortunately it doesn’t work for most of the page templates in my custom built theme, despite enabling wp_get_attachment_image support and ACF support. Per your FAQ that leaves passing the html to get_lazysizes_html, which as a non-dev I have no idea how to do.

    Another plugin I came across which does have an option that works with my theme is Florian Brinkmann’s Lazy Loader:

    Unfortunately the plugin doesn’t offer any placeholder option, which is why I am still looking for a replacement.

    But the option that it does have and which gets it to work with my theme is to “Process the complete markup”. He describes that option as follows:

    Instead of just modifying specific parts of the page (for example, the post content, post thumbnail), the complete generated markup is processed. With that, all images (and other media, if you enabled it) will be lazy loaded. Because the plugin needs to process more markup with that option enabled, it might slow down the page generation time a bit. If your page contains HTML errors, like unclosed tags, this might lead to unwanted behavior, because the DOM parser used by Lazy Loader tries to correct that.

    Is that potentially something you think might make sense to consider as an option for your plugin?

Viewing 1 replies (of 1 total)
  • Plugin Author Patrick Sletvold


    Hi, and sorry for the late response. As far as I know WordPress doesn’t have built-in support for filtering the whole markup though, while haven’t looked too much into processing it, with the right workarounds it should be doable. The reason I haven’t looked into it yet is, like the description for that plugin mentions, it would need to process more markup. And the workarounds needed could affect performance a bit too.

    That said, I could probably add it in a future version. Not sure if you still need it by then, but I’m sure it could be useful as another option to try for other people too. The lack of support for this in WordPress core is also the reason why there’s specific integration with ACF. Without full markup processing either this plugin needs to integrate support for other plugins/themes, or they need to implement support for this plugin. Implementing this would lessen the need for such integrations, or at the very least serve as a fallback when they don’t exist.

    – Patrick Sletvold

Viewing 1 replies (of 1 total)
  • The topic ‘Processing markup potentially possible?’ is closed to new replies.