WordPress.org

Ready to get started?Download WordPress

Forums

Google Calendar Events
JS on every page (3 posts)

  1. enderandrew
    Member
    Posted 2 years ago #

    This works well, and the author provides great support.

    I'm just curious however if it is necessarily for the JS scripts to be loaded on every single page.

    http://wordpress.org/extend/plugins/google-calendar-events/

  2. Ross Hanney
    Member
    Plugin Author

    Posted 2 years ago #

    Hello,

    It certainly isn't necessary for the plugin JavaScript files to be loaded on every page. However, it's quite difficult to determine on which pages the JavaScript is required.

    For example, if you're using the shortcode on a particular page, the plugin doesn't "know" this until WordPress fires the plugin shortcode handling function, by which time it is too late to conditionally load the JavaScript files.

    The alternative is to "look ahead" into the page / post content and search for the shortcode at a time when scripts can be conditionally loaded, but this could potentially be very slow, and is perhaps outweighed by browser caching of files anyway.

    Ross.

  3. Ross Hanney
    Member
    Plugin Author

    Posted 2 years ago #

    Actually, I did just find this, which describes a better method of conditionally loading stuff.

    I'll certainly look into this again for the next release.

    Thanks!
    Ross.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic