WordPress and jQuery

Add this code to the header.php file in the theme. Add this line before wp_head():

wp_enqueue_script("jquery");

Then you can write a script (inside script tags) – somewhat like this:

var $j = jQuery.noConflict(); // using j as selector to avoid conflicts

$j(function(){

    $j("#respond").hide(); // hide comment field

});

Based on this tutorial by Chris Coyier.

Published by

Per Thykjaer Jensen

I am a Senior Lecturer in front- and backend web programming at the Multimedia Design and Communication Programme at Business Academy Aaarhus.

I speak several languages: PHP, Python, MySQL, JavaScript, Nodejs, HTML, CSS, and … Danish.

Background: MA it, interaction and multimedia – MA Literature history – BA Art History.

Leave a Reply