StudioPress Community Forums
  StudioPress Community Forums > Forums > General Discussion
For help and support, access to your downloads, or to manage your account please log into My StudioPress.

These forums have been set to read-only so you can browse the existing topics for any questions you may have.

For general discussion on WordPress, CSS and design (NOT for support) visit the new Community Forums.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #9  
Old 09-22-2012, 03:18 AM
thamesidemedia thamesidemedia is offline
Registered User
Genesis Member
Pro Plus Member
 
Join Date: Jan 2012
Location: London
Posts: 35
Default

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:30 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.