Call: (209) 560-6611

Add jQuery script to WordPress

Date: April 21, 2016 Author: ang Category: Tutorials WordPress Comments: 0

jQuery is built into WordPress and you can add a jQuery script to your self hosted WordPress website using the built in wp_enqueue_script() function.

  1. Create a simple jQuery js file and call it 'test.js'.
  2. Save the js file in your WordPress, theme's 'js' folder on your server.
  3. Modify the 'functions.php' file in the root directory of your WordPress website to include this line of code: wp_enqueue_script( 'test', get_template_directory_uri() . '/assets/javascripts/test.js', array(), '1.0.0', true);

Test refresh your website and the alert popup should appear.

Leave a Reply

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

Before you post, please prove you are sentient.

What is the outer covering of a tree?

Before you post, please prove you are sentient.

what is 5 in addition to 4?