Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I use nextgen gallery in a multisite. How can I disable all scripts and styles? These thing are loaded in the code of my site:

<link rel='stylesheet' id='NextGEN-css'  href='http://mysite.com/wp-content/plugins/nextgen-gallery/css/nggallery.css?ver=1.0.0' type='text/css' media='screen' />

<script type='text/javascript' src='http://mysite.com/wp-content/plugins/nextgen-gallery/js/jquery.cycle.all.min.js?ver=2.9995'></script>

<script type='text/javascript' src='http://mysite.com/wp-content/plugins/nextgen-gallery/js/ngg.slideshow.min.js?ver=1.06'></script>

<!-- <meta name="NextGEN" version="1.9.7" /> -->
share|improve this question

3 Answers 3

up vote 1 down vote accepted

This takes care of NextGEN's slideshow and CSS, as well as the Shutter script and CSS that it also enqueues by default.

add_action('wp_print_scripts', 'wpse_82982_removeScripts');
add_action('wp_print_styles', 'wpse_82982_removeStyles');

function wpse_82982_removeScripts() {
    wp_dequeue_script('ngg-slideshow');
    wp_dequeue_script('shutter');
}

function wpse_82982_removeStyles() {
    wp_dequeue_style('NextGEN');
    wp_dequeue_style('shutter');
}

But: are you sure you want to do that? Maybe you can be a little selective, and only do that on selected pages / posts / categories.

Edit: to remove the commented-out meta tag too, add this filter:

add_filter('show_nextgen_version', '__return_null');
share|improve this answer
    
i use with Justified Image Grid - Premium WordPress Gallery , so the js and css of nextgen are useless now. Also, if i wont to this action in all of my sites in my multiste what is the code for wp-config.php? –  Alex Jan 24 '13 at 11:31
1  
I'd suggest you create a minimal plugin, then you can easily drop it into any site without modification. –  webaware Jan 24 '13 at 11:34
    
ok, thnx a lot :) –  Alex Jan 24 '13 at 11:37
    
Something last, do you know how can i remove and this <!-- <meta name="NextGEN" version="1.9.10" /> -->? –  Alex Jan 24 '13 at 11:42
1  
@Alex: see updated answer –  webaware Jan 25 '13 at 12:19

Another buyer has created this snippet https://gist.github.com/Davidlab/5134645

The proper way is to define('NGG_SKIP_LOAD_SCRIPTS', true);

Note that this'll be included in the next version of my plugin.

share|improve this answer
    
Thanks Firsh for this ability :) –  Alex Jun 24 '13 at 12:43
    
How can I disable this nextgen retarded code from custom template? Why dont you use wp_footer hooks? Instead stuff them freaking everywhere and your source code is horrible to understand. If I have jquery UI and jquery already in the head, dont put them again to the footer. –  Badr Hari Oct 3 '13 at 8:26
    
What do you mean by 'nextgen retarded code' exactly? What script are you talking about and are you talking to me? I do use wp_print_footer_scripts hooks and enqueue scripts with the footer set to true. Can you define 'stuffing them freaking everywhere'? My code is long and linear, it's better for me than having zillion classes an 600 small PHP files like NextGEN. I don't put jQuery again in the footer, I don't use jQuery UI either. If you have issues with JIG, contact me from my profile on CodeCanyon from the account you purchased it with, you don't need to edit any code, I'm happy to help. –  Firsh Oct 4 '13 at 10:19

In new version of nextGen if you want clean album css you just need

add_action('wp_print_styles', 'wpse_82982_removeStyles');

function wpse_82982_removeStyles() {
    wp_dequeue_style('nextgen_basic_album_style');
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.