Ready to get started?Download WordPress

Plugin Directory

NextGEN Gallery Optimizer

Improves your site's page load speed by preventing NextGEN's scripts & css from loading on posts without galleries.

V1.1.2 - 02/01/2013

  • Added new checks to make sure NextGEN Gallery is both installed and activated. A new admin notification accompanies this to assist new users with downloading, activating and setting up NextGEN.

  • Major improvements to Optimizer's automatic Fancybox installation. 1. Checks to make sure NextGEN Gallery is actually installed. 2. Automatically resets if the NextGEN database settings are deleted (so it can run again if reinstalled). 3. Now deactivates and restores former NextGEN Effects values when Optimizer's Fancybox option is switched off (as well as on plugin deactivation).

  • Improved our "can't write css file" admin notification to include a small "how to" guide on changing file permissions, to assist users who are new to managing self-hosted sites.

  • Replaced all upload instructions with a step-by-step guide to installing Optimizer via the WordPress admin. This method of installation is much faster than FTP, largely automated and most importantly, ensures the correct file ownership and permissions are set.

  • Changed Google-hosted jQuery to version 1.8.3 to match the version now included in WordPress 3.5.

  • Updated the Basic version's messaging in regards to the [Show as slideshow] text link for greater clarity.

  • Removed the donate and hire me boxes from the Basic version's settings page, as some users had expressed annoyance.

  • Explicitly defined database settings variables as globals so they're able to be used inside functions called on register_activation_hook().

V1.1.1 - 08/11/2012

  • Added a dynamic administrative message on the front-end for logged-in admins, which displays on posts/pages where unsupported shortcodes are being used. It's intended to inform admins about the Basic version's limitations in case they skipped the documentation, and highlight the Premium version's feature set in case it would be more appropriate for their requirements. [Basic only]

  • Added a check to make sure jQuery isn't being deregistered in a user's theme, as it will break Fancybox. This regex runs on the plugins page and Optimizer's settings page in the admin, and looks for variants of "wp_deregister_script('jquery');" in the functions.php files of both the main active theme and the child theme (if present). If detected (and not re-registered with a CDN version), users are alerted via a message in the admin. [Basic and Premium]

  • Added a blank index.php file inside each of Optimizer's folders to prevent Google from accessing and indexing the Apache directory tree. [Basic and Premium]

V1.1 - 12/07/2012

  • Added a conditional bottom margin in Fancybox's image height calculations to make room for single-line titles. By default, especially with large images, the titles would be squished against the bottom of the viewport.

  • Added new options that allow users to choose between WordPress's included jQuery or Google-hosted jQuery. We used to just run the Google-hosted script, but as users have reported compatibility issues (even with the jQuery.noConflict(); method added in the last update) -- and that those issues have been resolved simply by using the built-in version instead -- I thought it would be best to make WordPress's jQuery the default and provide Google-hosted as an option.

  • Added support for WordPress's native Thickbox lightbox integrated with NextGEN Gallery.

  • Added support for NextGEN's built-in Shutter effect.

  • Added support for NextGEN's JW Image Rotator assistant (Premium) after permission granted from the authors. Turns out we only needed to include WordPress's native swfobject.js on the slideshow shortcode (if activated at Gallery --> Options --> Slideshow --> "Enable flash slideshow"), and grab the file path to the user's downloaded imagerotator.swf file entered below that.

  • Added support for NextGEN's AJAX pagination on the [imagebrowser id=x] shortcode (Premium). NextGEN also applies this to Gallery pages and Album gallery pages, but as I've outlined in the FAQ, the implementation is far too buggy, inconsistent and restrictive to add here. From a user interface perspective, it works rather well with imagebrowser (albeit, issuing notices), so I have added it in...but for the galleries, it's really not necessary. I'd say it's better to be without, than have it break the [Show as slideshow] links on the gallery pages.

  • Added a function to Fancybox's scripts (Premium) to trigger an auto-resize when a user resizes their browser window. I've also added a slight delay for smooth animation and it looks great! Previously, the lightbox did center itself on window resize, but the image wouldn't rescale without first exiting and re-entering the lightbox.

  • Changed three function names after adding support for Shutter and Thickbox (to be more descriptive and consistent).

  1. nggo_load_fancybox is now nggo_load_fancybox_scripts
  2. nggo_fancybox_style is now nggo_load_fancybox_styles
  3. nggo_nextgen_style is now nggo_load_nextgen_styles
  • Removed nggo_custom_style. Its functionality has been merged into nggo_load_nextgen_styles.

  • Added version number to Optimizer's HTML comment to assist with support.

  • Added a link to Premium in the plugin description.

V1.0.8 - 18/06/2012

  • Changed "compatible up to" version number after thorough testing on WordPress 3.4.

  • Added the jQuery.noConflict(); method to improve compatibility with plugins and themes using other javascript libraries/frameworks including script.aculo.us, Prototype and MooTools.

  • Fixed a Fancybox/NextGEN Gallery integration issue where a small white line would appear underneath the lightbox when no title was set.

  • Recompiled jquery.fancybox-1.3.4.pack.js with Google Closure Compiler after above fix.

  • Switched Google-hosted jQuery to the latest version (1.7.2).

V1.0.7 - 29/05/2012

  • Converted all jQuery "$" selectors in Fancybox's invocation code to "jQuery" to prevent conflicts with other plugins and scripts.

  • Fixed a minor bug in the "file not writable" admin message whereby the filename was omitted.

V1.0.6 - 04/04/2012

  • Installation of Fancybox is now fully automated and set by default. The plugin saves a copy of existing settings on the Gallery --> Options --> Effects page, then updates them with the Fancybox code so we don't have to enter it manually. Any changes to this code are then overridden as long as the Fancybox option on the settings page is checked. This helps prevent accidental changes that would break integration. A safety switch, if you will. There's also an admin message that prompts users to uncheck the Fancybox setting on the options page if they want to use another custom lightbox/effect. On deactivation, Optimizer will attempt to restore the former values...but only if Fancybox is selected (don't want to write over newer custom values!)

  • Removed installation instructions from the options pages as, well, we don't need them anymore.

  • After discovering WordPress's auto-update downloads the full version of the plugin (not just the files that have changed), and with no way to redirect back to the plugin settings page from the upgrade page, I've set the Fancybox stylesheet regex to run on admin_init instead. Since we only want it to run once (on first activation and after auto-update), I've defined a version number in the code and added a "version" option to the settings array to check against.

  • Added (if !defined()) to skip_load_scripts to avoid possible error messages when both basic and premium versions of the plugin are installed.

  • Added extra fields to the options page for persistent plugin settings.

V1.0.5 - 20/03/2012

  • Replaced my shortcode regex with WordPress's native get_shortcode_regex() function for more precise matching.

  • Added a pre-emptive fix to solve a common problem where jQuery dependent scripts (such as Fancybox and NextGEN's slideshow) break if jQuery doesn't load first. Added array('jquery') dependencies to wp_register_script calls (which forces jQuery to not only load when these scripts are called, but load first), as well as add_action priority values to influence their order.

  • Launched my new NextGEN Gallery Optimizer Premium version which supports ALL TEN of NextGen's shortcodes, supports the [show as slideshow] link, adds targeting for shortcode sub-pages (eg. stylesheet only on album page / both styles and scripts (if selected) on album GALLERY pages) and adds the removal of NextGEN's version number comment.

  • Added promotional box to the basic version's settings page.

V1.0.4 - 18/03/2012

  • Added an automatic redirect that sends first time users to the plugin options page on first activation.

  • Added a one time welcome message on the redirect.

  • Added a default setting for the stylesheet in case anyone forgets to set it.

  • Added email contact to the settings page and main page at the plugin repository.

  • Changed all instances of $nextgen_gallery_optimizer to a global $nggo_options variable for less cumbersome handling of database options.

  • Moved the stylesheet dropdown if statements to scripts-and-styles.php to keep them together with their register and enqueue calls.

V1.0.3 - 09/03/2012

  • Replaced all hard-coded scripts and styles with WordPress's built-in wp_enqueue_scripts and wp_print_styles functions for better compatibility with other plugins.

  • Added several instances of wp_deregister_script to pages we're serving jquery and jquery.fancybox.js on. This will prevent conflicts (and page load overhead) if any other installed plugins try to serve duplicate scripts.

  • Added /wp-content/ url prefix to custom css input box on the settings page. Also made the Fancybox installation instructions clearer with larger text, a link to the NextGEN Effects page, and extra advice in the Tips section on plugin conflicts.

V1.0.2 - 07/03/2012

  • Added support for WordPress Pages

  • Fixed an issue where some page elements overlap Fancybox and prevent the close button from functioning (in particular the title text, header image and menu bar in Twenty Eleven).

  • Fixed a surprisingly common issue involving Fancybox not working in IE6 & IE8. My solution was to develop a regular expression that runs on the plugin options page ONLY to write the full urls Microsoft.AlphaImageLoader requires into the static Fancybox stylesheet. Much more efficient than some methods I've seen (such as dynamically rebuilding the stylesheet on every page view in php).

  • Switched JQuery to the latest version 1.7.1 (Google hosted)

V1.0.1 - 01/03/2012

  • Resolved issue regarding upload to WordPress.org repository

V1.0 - 28/02/2012

  • Initial release on February 28th, 2012.

Requires: 3.1.2 or higher
Compatible up to: 3.5.2
Last Updated: 2013-1-2
Downloads: 145,407


3 stars
3.5 out of 5 stars


0 of 1 support threads in the last two months have been resolved.

Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 40,5,2 0,1,0 50,2,1
100,1,1 33,3,1
29,7,2 60,5,3 100,1,1
67,3,2 50,4,2