Select Page

JQuery is great for WordPress. It’s a clear and effective library for Javascript. It gives WordPress some of its best functionality. Custom JQuery code can be added to plugins and themes. This code can make something work great but kill some other standard feature.

WordPress already includes JQuery. Here’s how to include your own. In the header.php file of your theme before wp_head(), include this:

<?php wp_enqueue_script(“jquery”); ?>

So it looks like this, instead:

<?php wp_enqueue_script(“jquery”); ?>
<?php wp_head(); ?>

Now you can call your own jQuery include:

<script type=”text/javascript” src=”/web/path-to-theme/”<?php” bloginfo(“template_url”); ?>/jQuery.js”>

This should handle most cases, but if you want to be really safe, set “no conflict” mode in your own jQuery. That cleans up collisions between competing JavaScript functions.

var $j = jQuery.noConflict();


// some function code



Share this page: Sharing Facebook Twitter LinkedIn Copy Text