Created
January 21, 2016 13:32
-
-
Save juanfra/1e946354c8a1f815a70d to your computer and use it in GitHub Desktop.
Load custom JS file.
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
<?php | |
//* Do NOT include the opening php tag | |
add_action( 'wp_head', 'nice_load_custom_js', 10 ); | |
function nice_load_custom_js() { | |
if ( file_exists( get_stylesheet_directory() . '/custom.js' ) ) { | |
wp_register_script( 'nice-custom-scripts-js', get_stylesheet_directory_uri() . '/custom.js', array( 'jquery' ) ); | |
wp_enqueue_script ( 'nice-custom-scripts-js' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment