Skip to content

Instantly share code, notes, and snippets.

@Edwardtonnn

Edwardtonnn/custom.js

Last active Jul 11, 2018
Embed
What would you like to do?
wp_enqueue script
(function($) {
// $ Works! You can test it with next line if you like
console.log("I'm alive!");
})( jQuery );
//Just the script
wp_enqueue_script(
'custom',
get_stylesheet_directory_uri() . '/js/custom.js',
array('jquery'),
null,
true
);
//The entire function
//Function includes deregistering the default jquery
// include custom jQuery
function shapeSpace_include_custom_jquery() {
wp_deregister_script('jquery');
wp_enqueue_script(
'jquery',
'https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js',
array(),
null,
true);
}
add_action('wp_enqueue_scripts', 'shapeSpace_include_custom_jquery');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment