Last active
December 10, 2020 15:18
-
-
Save aliaramli/b263e4fb8f3b98901aec8efb243b3f12 to your computer and use it in GitHub Desktop.
Sample adding Javascript and CSS files to 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 wp_add_javascripts() { | |
wp_enqueue_script('utils-js', | |
get_stylesheet_directory().'/assets/js/utils.js', array('jquery'),'1.1', true); | |
} | |
function wp_add_styles() { | |
wp_enqueue_style('utils-css', | |
get_stylesheet_directory().'/assets/css/utils.css'); | |
} | |
//add to the wp_enqueue_scripts hook. | |
add_action( 'wp_enqueue_scripts', 'wp_add_javascripts' ); | |
add_action( 'wp_enqueue_scripts', 'wp_add_styles' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment