Created
March 4, 2019 09:02
-
-
Save thetwopct/127bb7b5ae25d1f8898b6e99970928a5 to your computer and use it in GitHub Desktop.
Add javascript file per page for WordPress
This file contains 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 load_js_assets() { | |
if( is_page( ID ) ) { | |
wp_enqueue_script('my-js', 'PATH TO JS FILE', array('jquery'), '', false); | |
} | |
} | |
add_action('wp_enqueue_scripts', 'load_js_assets'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment