Another option I used for a project is making the load ‘page’ specific. Where i didn’t need any other pages to load the script. Here’s an example for only loading the script on a page called, ‘blog’.
/**
* Determines if the jQuery plugin and corresponding options should
* be output onto the page.
*
* @return bool
*/
function shouldLoadJavascript() {
// Don’t need to load the plugin on single pages
if (is_page(‘blog’)) {
return true;
}
return true;
}
}