Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    The wp-blocks HTML content of the not-working page has not one mention of YouTube, so LYTE can simply not act on that I’m afraid Oksana.

    What you could try as a workaround (as you’re using Autoptimize) is hook into the autoptimize_html_after_minify filter and feed the incoming HTML through lyte_parse() ?

    Thread Starter oksanaromaniv

    (@oksanaromaniv)

    You’re right. The links to videos are in the reusable blocks that are saved as blocks with “ref” attribute. I will try the workaround, thanks! Though I thought that the plugin is hooking into the_content() after all the blocks are parsed so it should have access to the full HTML, shouldn’t it?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Well, based on my testes the the_content() filter is active _before_ gutenberg markup is parsed by WordPress :-/

    Thread Starter oksanaromaniv

    (@oksanaromaniv)

    Hello @optimizingmatters ,

    With the autoptimize_html_after_minify it parsed the content inside reusable blocks, but didn’t attach the event listeners: the background image and “click” event were not added as on other pages. What is strange that on the draft page it picked content from the reusable block and added events correctly, but on the /aktuell/ page not ??

    Thread Starter oksanaromaniv

    (@oksanaromaniv)

    Hey, managed to get it working with the next code:

    remove_filter( 'the_content', 'lyte_parse', 4 );
    add_filter( 'the_content', 'lyte_parse', 10 );

    Looks like the “do_blocks” is added with priority 9, so moving the parser helped in my case ??

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    So was the lyte JS (and CSS) missing when you used autoptimize_html_after_minify?

    and when talking about “on the draft page”, are you also referring to the solution with autoptimize_html_after_minify?

    the priority flag, obviously! great find! ??

    now why did I bring that down to 4 back in the day .. must try to remember … :-/

    Thread Starter oksanaromaniv

    (@oksanaromaniv)

    So was the lyte JS (and CSS) missing when you used autoptimize_html_after_minify?

    On the working page the styles (general and background) were printed inline. Not sure about the JS though. On the not working page, there were no inline styles for the lyte-wrapper.

    and when talking about “on the draft page”, are you also referring to the solution with autoptimize_html_after_minify?

    Yes.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    I *think* I made it priority 4 a very long time ago to ensure LYTE could act on youtube links before the WordPress embed magic could, but as LYTE now also “does” iframe-code that is likely not needed any more, so I’ll switch to the default 10 for the next release. Fingers crossed ??

    Thread Starter oksanaromaniv

    (@oksanaromaniv)

    Great! I hope that priority “10” will work well ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Videos are lazy loaded on one page and not on the other’ is closed to new replies.