NextCellent Gallery - NextGEN Legacy
How to remove the JS and CSS includes? (4 posts)

  1. ispreview
    Posted 2 years ago #


    I don't need the lines that NCG adds to my pages header and am just wondering how do I stop these three from showing?

    <link rel='stylesheet' id='NextGEN-css'  href='http://www.mysite.com/beta/content/wp-content/plugins/nextcellent-gallery-nextgen-legacy/css/nggallery.css?ver=1.0.0' type='text/css' media='screen' />
    <script type='text/javascript' src='http://www.mysite.com/beta/content/wp-content/plugins/nextcellent-gallery-nextgen-legacy/js/jquery.cycle.all.min.js?ver=2.9995'></script>
    <script type='text/javascript' src='http://www.mysite.com/beta/content/wp-content/plugins/nextcellent-gallery-nextgen-legacy/js/ngg.slideshow.min.js?ver=1.06'></script>


  2. niknetniko
    Posted 2 years ago #

    • To disable the style, go to Galleries->Style, and unselect the 'Activate and use style sheet' option.
    • Add this code to your functions.php file (from your theme) to disable the scripts:
      define('NGG_SKIP_LOAD_SCRIPTS', true);

    Do note that this will prevent NextCellent from working correctly. If you just want to disable the loading on pages where NextCellent isn't used (and still load it when it's used), please look for a plugin, as this isn't supported at the moment.

  3. ispreview
    Posted 2 years ago #

    Excellent, thanks Nik.

    I only use basic image attachments and featured images/thumbnails on articles anyway, so removing the JS/CSS for NCG makes no difference to me.

  4. WPReady
    Plugin Author

    Posted 2 years ago #

    Although Niko's solution will work,maybe it is bit extreme. There is a way to selectively disable the scripts and styles:

    add_action( 'wp_print_scripts', 'de_script', 100 );

    function de_script() {
    wp_dequeue_script ( 'jquery-cycle' );
    wp_deregister_script( 'jquery-cycle' );
    wp_dequeue_script ( 'ngg-slideshow' );
    wp_deregister_script( 'ngg-slideshow' );

    add_action ('wp_head','de_style',1);

    function de_style() {

    The second action was attached to wp_head but maybe there is a better hook. This was tested on dev environment.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.