Created
April 20, 2018 15:51
-
-
Save lizardking8610/defcdf65f9b85c57536f5142dd5864b7 to your computer and use it in GitHub Desktop.
How To Properly Enqueue jQuery in WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_scripts_method() { | |
if ( !is_admin() ) { | |
wp_enqueue_script('jquery-ui-accordion'); | |
wp_enqueue_script( | |
'custom-accordion', | |
get_stylesheet_directory_uri() . '/js/accordion.js', | |
array('jquery') | |
); | |
wp_enqueue_script('jquery-ui-tabs'); | |
wp_enqueue_script( | |
'custom-tabs', | |
get_stylesheet_directory_uri() . '/js/tabs.js', | |
array('jquery') | |
); | |
} | |
} | |
add_action('wp_enqueue_scripts', 'my_scripts_method'); | |
wp_register_style('jquery-custom-style', get_stylesheet_directory_uri().'/css/jquery-ui-1.12.1.custom/jquery-ui.css', array(), '1', 'screen'); | |
wp_enqueue_style('jquery-custom-style'); |
`function my_scripts_method() {
if ( !is_admin() ) {
wp_enqueue_script('rez');
wp_enqueue_script(
'rez',
get_stylesheet_directory_uri() . '/js/rez.js',
array('jquery')
);
}
}
add_action('wp_enqueue_scripts', 'my_scripts_method');`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'll put this code in your functions.php file. At the bottom is fine.