In the past, I've used quite a few themes as well as plug-ins that have used wordpress and query, so I thought I would share a few tips with everyone such that you do not make the same mistakes that I did in the beginning and so that you could make your work more efficient.
- First off, make sure you don't use the wp_enqueue_script() tag in your html page. A lot of people make this mistake, but realize that when you do this it oftentimes causes more problems than you can or would ever want. Instead, you would like to make sure 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 is something unique so that you don't get things confused.
- Secondly, make sure you load your JQuery from the Google Ajax Library. Since Wordpress already includes a call to which incorporates Jquery, calling the code; wp_enqueue_script('jquery'); will 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 would automatically be added to the head of your HTML page. However, if you will 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, ensure you load Jquery as a dependent script. If you use the wp_enqueue_script() function property, this'll 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 that offer free tips and tricks like ASP tutorial, ASP.NET tutorial, and Jquery tutorial. Most of all these tutorials will be text or image based. You can 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, as well as Jquery tutorial, but you want to learn CSS or other codes, you could do this on-line as well. It is all pretty simple depending on the type of site you look at. If its cheat sheets you are looking for and you want to learn CSS or you want cheats on HTML, CSS or ASP, you can make use of a site like Web Monkey or W3Schools to help you out. To know more about asp tutorial, learn css, asp.net tutorial, jquery tutorial logon to http://www.sitepoint.com
Loading...