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.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enable Notifications OK No thanks

Vi anvender cookies for at forbedre din oplevelse, analysere trafik og tilpasse indhold. læs videre / more information

Multimusen.dk will set a few cookies from Doubleclick, Google and the Social Media plugins they ay set some cookies. Some of my pages use APIs - such as YouTube, LinkedIn, Google Fonts, Google Maps, Mapbox, Spotify, Jetpack, Twitter, Facebook &c.. Such plugins may set the odd cookie.

Close