An alternative way to minimize the impact of NextGEN scripts and stylesheets from loading into wp_head is by adding the if_page variable into the function load_styles() section.
Replace:
function load_styles() {
// check first the theme folder for a nggallery.css
if ( nggGallery::get_theme_css_file() )
wp_enqueue_style('NextGEN', nggGallery::get_theme_css_file() , false, '1.0.0', 'screen');
else if ($this->options['activateCSS'])
wp_enqueue_style('NextGEN', NGGALLERY_URLPATH.'css/'.$this->options['CSSfile'], false, '1.0.0', 'screen');
with
function load_styles() {
// check first the theme folder for a nggallery.css
if ( is_page(<em>xx</em>) && ( nggGallery::get_theme_css_file() )
wp_enqueue_style('NextGEN', nggGallery::get_theme_css_file() , false, '1.0.0', 'screen');
else if (is_page(<em>xx</em>) && ($this->options['activateCSS']) )
wp_enqueue_style('NextGEN', NGGALLERY_URLPATH.'css/'.$this->options['CSSfile'], false, '1.0.0', 'screen');
where the value xx equals the page number where the gallery is loaded.
Adding the conditional tag if_page allows you to specify for which pages this code needs to be applied. If you wanna do an array of pages (more than one page), make it look like this:
(is_page(array(<em>xx, yy, zz</em>)))
where xx, yy, and zz are three different pages. List as many pages as are needed.
Remember to add the necessary open and close parentheses () in order not to break the PHP.