Created
May 7, 2021 18:11
-
-
Save prosantamazumder/f3ebd4f1d2d906c865ce10250d7b921b to your computer and use it in GitHub Desktop.
Proper way to enqueue scripts and styles 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
/** | |
* Proper way to enqueue scripts and styles | |
*/ | |
function wpdocs_theme_name_scripts() { | |
wp_enqueue_style( 'style-name', get_stylesheet_uri() ); | |
wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true ); | |
} | |
add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment