WordPress.org

Support

Support » Plugins and Hacks » Live Blogging » [Plugin: Live Blogging] [BUG] JS is enqueued even when not needed

[Plugin: Live Blogging] [BUG] JS is enqueued even when not needed

  • When I am displaying a page with no liveblogs there’s no need to load live-blogging.js, as it slows down the page.

    It is possible to do this, but I don’t know exactly how to recognize when “it is needed”: if we’re displaying single posts it’s easy, but in home page I don’t know how can we discover if “it is needed”

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author chrisnorthwood

    @chrisnorthwood

    Yeah, this is definitely something that could be improved – the issue is that when scripts are output (in the header), we don’t know if something’s going to be output that requires it or not.

    It’s not an issue unique to this plugin, but I do accept it could be improved.

    actually, there’s a way to do so. It’s enough to call wp_enqueue inside a the_posts filter. Actually, the best would be to receive an action AFTER the_posts has been called, but I haven’t found a way to do this.

    You can see an example here:

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Live Blogging] [BUG] JS is enqueued even when not needed’ is closed to new replies.
Skip to toolbar