How to show js of NextGEN Gallery plugin only on certain pages

760 views Asked by At

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');
}
1

There are 1 answers

0
MaxRev17 On