Wordpress JqueryWorldpress Jquery
Use of ' $' instead of ' jQuery' in WordPress
The WordPress comes with its own jQuery libary release (for longevity's sakes, while I'm writing this WordPress it's in 3.2.1). To use jQuery in your WordPress plug-ins and your WordPress topics "The Right Way", you just have to queue the scripts (probably via the functions.php of your topic).
A lot of plug-in writers and themes designers are conscious of this, and they use jQuery instead of $ to be sure. #some-element ").yaddaYaddaYaddaYaddaYadda(); jQuery("#some-element").yaddaYaddaYaddaYadda(); Here's the thing...riting jQuery a billion time in a scripted makes it more difficult to reread and inflates its magnitude. When loading the skript in the bottom line (which you should do in most cases), you can put the source file in an unknown feature (technically any IIFE), where you hand over jQuery to be displayed on $. // console.log($); })( jQuery ); if you really need to upload the skripts in the top line, you probably still need to use a document-ready feature, so you can just insert $ there.
console.log($); }); Go out and type beautiful looking jQuery!
Embed jQuery in WordPress (The right way)
You can simply jQuery, put it on your web site and from your headers create a hyperlink to it. see your pdf files in the section. First, some plug-ins use and will use the jQuery lib. A lot has been changing with the way WP scripts are loaded since this paper was published.
So, when we are declaring our user-defined scripts, we put the $deps argument to array('jquery') and call it a tag. Well, let's say we want to use a jQuery that is different from the one in WordPress. You could just put it in the queue, but then two copies/versions of jQuery would be on the page (yours and WP's).
So, before we queue our own jQuery release, we need to unregister the WP release. js', array(), null, true); add_action('wp_enqueue_scripts','shapeSpace_include_custom_jquery'); here we use wp_deregister_script() to unregister the jQuery from WP before we queue our own release, for example the jQuery jlib, 3.1.1 hosting from Google, 3.1.1. Of course, you will want to modify the $src parameters to adjust the address of the jQuery scripts you want to use.
This is the actual "right way to integrate jQuery into WordPress". An important hint for topic developers: Published topics should use jQuery from WP and not deregister. The other thing is that WordPress already contains a copy of jQuery. This is how you can intelligently (and intentionally) use jQuery in your design.