How Does Jquery Help You In Wordpress?

Published: 06th July 2011
Views: N/A
Ask About This Article Print Republish This Article
In the past, I have used quite a few themes and even plug-ins that have used wordpress and even query, so I thought I would share a few tips with everyone so that you don't make the same mistakes that I did in the beginning and even so that you can make your work more efficient.

- First off, guarantee you don't use the wp_enqueue_script() tag in your html page. A lot of people make this mistake, but realize that while you do this it normally causes more problems than you could or would ever want. Rather, you would like to ensure you use the Jquery code below:

function my_init()
if (!is_admin())
wp_enqueue_script('jquery');
add_action('init', 'my_init');

Obviously you can replace my_init with something a little more memorable. Just make sure it's something unique so that you do not get things confused.

- Secondly, make sure you load your JQuery from the Google Ajax Library. Since Wordpress already includes a call to that incorporates Jquery, calling the code; wp_enqueue_script('jquery'); would allow it to automatically load into the file.


- Third, make sure you load Jquery in the footer of the coding. If you use the first two tips I mentioned, then Jquery will automatically be added to the head of your HTML page. However, if you’ll like it added to the bottom instead, you would have to use the $in_footer parameter. The modified code will look something like this:

function my_init()
if (!is_admin())
wp_deregister_script('jquery');
// load the local copy of jQuery in the footer
wp_register_script('jquery', '/wp-includes/js/jquery/jquery.js', false, '1.3.2', true);
// or load the Google API copy in the footer
//wp_register_script('jquery', '', false, '1.3.2', true);
wp_enqueue_script('jquery');
add_action('init', 'my_init');

- Lastly, make sure you load Jquery as a dependent script. If you use the wp_enqueue_script() function property, this will automatically allow wordpress to manage the order of your script tags. A nice addition to have!

If you are still learning programming codes and even you need extra help, you can find a lot of sites on-line which offer free tips and tricks such as ASP tutorial, ASP.NET tutorial, and Jquery tutorial. Most of all these tutorials will be text or image based. You could find a few that are videos, but with something like this, it seems text is the best way to go.


Even if you are semi-educated in the ASP tutorial, ASP.NET tutorial, and Jquery tutorial, but you would want to learn CSS or other codes, you can do this on-line as well. It's all pretty simple depending on the type of website you go to. If its cheat sheets you are looking for and even you want to learn CSS or you want cheats on HTML, CSS or ASP, You could even make use of the websites like web monkey or even W3Schools to help you. To know more about asp tutorial, learn css, asp.net tutorial, jquery tutorial logon to http://www.sitepoint.com

This article is free for republishing
Source: http://lindataylor.articlealley.com/how-does-jquery-help-you-in-wordpress-2308386.html


Report this article Ask About This Article Print Republish This Article


Loading...
More to Explore
 


Ask a Professional Online Now
27 Experts are Online. Ask a Question, Get an Answer ASAP.
Type your question here...
Optional:
Select...