Hi mrdumont,
Thanks for downloading NextGEN Gallery Optimizer Premium, and thanks for taking the time to read the documentation!
I have been working on do_shortcode support for templates for quite some time now, but I’ve discovered that, like with widgets, WordPress cannot currently detect the presence of a do_shortcode call until after the head of a page has been processed. By then, it’s too late to load the required scripts (loading them in the footer often causes them to break).
However, I have recently come up with a solution! It involves adding options to Optimizer’s settings page whereby users can choose to conditionally load their required scripts and styles wherever they like. (eg. slideshow scripts on homepage only or on certain posts or pages etc).
I hope to integrate this in the next version, but in the meantime…
If you add the following to the top of nextgen-optimizer-premium-extras.php (just after the opening <?php tag), you can instruct the slideshow scripts to load on whichever pages you want them to (before WordPress even detects your do_shortcode call)…
/**********************************************************************
* conditionally add slideshow scripts for do_shortcode call in theme
**********************************************************************/
function nggop_do_shortcode_slideshow() {
global $post;
global $nggop_nextgen_options;
if (is_single()) {
if (have_posts()) {
while (have_posts()) {
the_post();
if (isset($nggop_nextgen_options['enableIR']) && ($nggop_nextgen_options['enableIR'] == '1')) {
// if jr image rotator is switched on at gallery --> options --> slideshow
add_action('wp_enqueue_scripts', 'nggop_load_jr_image_rotator', 1001); // load last
} else {
// else load scripts for built-in jquery slideshow
add_action('wp_enqueue_scripts', 'nggop_load_jquery', 1000);
add_action('wp_enqueue_scripts', 'nggop_nextgen_slideshow_scripts', 1001); // load last
add_action('wp_head','nggop_jquery_no_conflict_inline_js', 1000);
}
add_action('wp_print_styles', 'nggop_load_nextgen_styles', 1000); // see scripts-and-styles.php for function
}
}
}
}
add_action('wp','nggop_do_shortcode_slideshow');
The code above is set to run conditionally on Post pages only, but you can change the line “if (is_single()) {
” to whatever you like…eg is_home for the homepage, is_page(‘about’) for your About page. For a full list of conditionals, please see this Codex page.
Hope this helps!
Cheers,
Mark.