Open Source Tutorials - Open Source Training
Open source training & tutorials from experienced, passionate people
chrome icon firefox icon ie icon opera icon safari icon Sings in these Browsers
A- A A+

By A Web Design

Welcome, Guest
Username Password: Remember me

jQuery to work in WordPress
(1 viewing) (1) Guest
All your queries regarding
Wordpress Blog,
Installation of Wordpress Blog,
Configuration of Wordpress ,
Using Wordpress as a CMS,
Wordpress Plugins and tonnes more... will be solved in this forum...
  • Page:
  • 1
TOPIC:

jQuery to work in WordPress

jQuery to work in WordPress 10 months, 2 weeks ago #680

  • yoko
As I understand wordpress already loads a jquery library via a googles website by default in the functions.php file. So I know not to load another jquery library as it can result in problems

I know that prototype came before jquery so using "$" will run you into errors. Instead we should use jQuery(). And in no conflict mode we can use the shorthand $j.

So all that stuff is obvious. So what do I do when the library is loading properly (i did a view source and it loads fine), the .js file is using "jQuery()", and I am not trying to call another jquery library?

I've been going nuts for the past week trying to figure out how to get jQuery to work in WordPress. Has anyone figured it out?

Re: jQuery to work in WordPress 10 months, 1 week ago #683

  • sandhya
  • OFFLINE
  • Senior Boarder
  • Posts: 42
  • Karma: 0
WordPress doesn't use a Google CDN version of jQuery; rather, it bundles a version of jQuery (currently, version 1.6.1) in core.

To use jQuery on the front end (i.e. in your Theme), you need to add something like the following to functions.php:

function mytheme_enqueue_scripts() {
if ( ! is_admin() ) {
wp_enqueue_script( 'jquery' );
}
}
add_action( 'wp_enqueue_scripts', 'mytheme_enqueue_scripts' );

If you can provide a bit more specific information about what you're trying to do, we can provide more specific assistance.
  • Page:
  • 1
Time to create page: 1.13 seconds
OSV Newsletter


Receive HTML?

NOTE: To prevent subscription to the OSV newsletter, uncheck the checkbox above.
Guest Blog for OSV
Free Ebook Download