Skip to content

Instantly share code, notes, and snippets.

@interactiveRob
Created July 6, 2018 19:50
Show Gist options
  • Save interactiveRob/608921a6248031f5fd1e1ee200cefc86 to your computer and use it in GitHub Desktop.
Save interactiveRob/608921a6248031f5fd1e1ee200cefc86 to your computer and use it in GitHub Desktop.
Basic WP enqueue scripts and Styles
/**
* 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