![]() |
|
||||||
|
|
Thread Tools | Display Modes |
|
#9
|
|||
|
|||
|
It doesn't work in the header scripts box on its own, and I think that is because it still needs the jQuery.
I know you've said that the WordPress jQuery is already in Genesis, but I can't find it and it isn't loading in the head. Also, I only want the fancybox on two templates - if I put it in the header scripts box, won't it be global? Actually I've now got it working by doing this: I've used this code to load jQuery in the functions file: /** Add the WP version of jQuery to head */ function my_scripts_method() { wp_enqueue_script('jquery'); } add_action('wp_enqueue_scripts', 'my_scripts_method'); I've then loaded the fancybox script on just the two pages where I want the fancybox. On one page it is within the template. On the other page it is surprisingly within the loop! It is working. However, it's probably not the best method, and I don't feel confident about it for other custom javascripts. I like to use best practices for everything I do. So how would you go about loading something like fancybox, which depends on jQuery, on just a few templates, not globally? |
| Thread Tools | |
| Display Modes | |
|
|
© Copyright 2012 Copyblogger Media LLC · StudioPress™ is a trademark of Copyblogger Media LLC
Privacy Policy | Refund Policy | Terms of Service | Affiliate Program | Contact Us