[Resolved] [Plugin: NextGEN Gallery] template_redirect should be wp_print_scripts/wp_print_styles?
G’day, thanks for your excellent plugin.
I am using NextGEN to manage the image carousels in the page headers of a website I’m working on. A simple custom template means I can have an image carousel with thumbnails that can be clicked to navigate the carousel. Very nice, and easy thanks to NextGEN.
It all works really well, except on pages mangled^H^H^H^H^H^H^Hmanaged by wp-e-commerce. For once, it isn’t the fault of wp-e-commerce! On these pages, the page template is redirected to a different template using the template_redirect action. As is normal with this action, once the template has been redirected, exit is called and the script ends. Any other template_redirect action hooks in the queue after wp-e-commerce’s hook are thus discarded.
What this means for NextGEN is that nggLoader::load_scripts() and nggLoader::load_styles() are never called on the wp-e-commerce purchase page. This is because NextGEN uses the template_redirect action to enqueue its scripts and styles. This is not what this action is meant for 🙂
When I replace the template_redirect action with wp_print_scripts and wp_print_styles in nextgen-gallery/nggallery.php, everything works as it should; specifically, the script ngg.slideshow.min.js which runs the image carousel is loaded.
So: is there a good reason for hooking template_redirect instead of wp_print_scripts and wp_print_styles? Patching the plugin to use the “correct” hooks fixes my problem, but are you using template_redirect instead for a reason?
- The topic ‘[Resolved] [Plugin: NextGEN Gallery] template_redirect should be wp_print_scripts/wp_print_styles?’ is closed to new replies.