Title: JQuery Initialization Plugin
Last modified: August 20, 2016

---

# JQuery Initialization Plugin

 *  [deadpickle](https://wordpress.org/support/users/deadpickle/)
 * (@deadpickle)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/jquery-initialization-plugin/)
 * Im trying to write a simple plugin that just initializes JQuery, JQuery UI and
   a few widgets.
 *     ```
       <?php
       	/*
       	Plugin Name: Jquery Initialization
       	*/
   
       	function jquery_enqueuer() {
       		global $wp_scripts;
   
       		if(!wp_script_is('jquery')) wp_enqueue_script('jquery');
       		if(!wp_script_is('jquery-ui-core')) {
       			wp_enqueue_script('jquery-ui-core');
       			$ui = $wp_scripts->query('jquery-ui-core');
       			$url = "http://ajax.googleapis.com/ajax/libs/jqueryui/{$ui->ver}/themes/smoothness/jquery-ui.css";
       			wp_enqueue_style('jquery-ui-smoothness', $url, false, $ui->ver);
       		}
       		if(!wp_script_is('jquery-ui-tabs')) wp_enqueue_script('jquery-ui-tabs');
       		if(!wp_script_is('jquery-ui-datepicker')) wp_enqueue_script('jquery-ui-datepicker');
       	}
   
       	//action to run after wordpress finishes loading but before headers are sent
       	add_action("init", "jquery_enqueuer");
       ?>
       ```
   
 * I used another simple page with a datepicker on it to test this. When I go to
   the page (sorry the page is localhost) nothing happens when I click on the datepicker.
   I right clicked and “Inspect Elements” and go to the “Network” tab. There I noticed
   that jquery.js loads but not jquery-ui or any of the other widgets. Can anyone
   give me some pointers on how to get them to load or any errors in the above plugin.
   Thanks in advance.

The topic ‘JQuery Initialization Plugin’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [deadpickle](https://wordpress.org/support/users/deadpickle/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/jquery-initialization-plugin/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
