I want css and javascript files of NextGEN Gallery show only on some pages. How can I do that? The plugin has a lot of javascript files and this makes websites slow.
This solution is not working:
if (is_page(48) || is_page(54) || is_page(4)) {
wp_register_script('nextgen_lightbox_context', plugins_url('lightbox_context.js', __FILE__), array('jquery'), false, true);
wp_enqueue_script('nextgen_lightbox_context');
wp_register_script('photocrati_ajax', plugins_url('ajax.js', __FILE__), array('jquery'), false, true);
wp_enqueue_script('photocrati_ajax');
}
I think the following resource may point you in the right direction:
http://wp.tutsplus.com/articles/tips-articles/quick-tip-conditionally-including-js-and-css-with-get_current_screen/