Skip to content

Instantly share code, notes, and snippets.

@jpmarchand
Last active September 17, 2016 15:36
Show Gist options
  • Save jpmarchand/96827f262598847efabb5723df252026 to your computer and use it in GitHub Desktop.
Save jpmarchand/96827f262598847efabb5723df252026 to your computer and use it in GitHub Desktop.
How to enqueue scripts and styles in a Genesis child theme?
//* Enqueue scripts and styles from CDN URLs
function enqueue_scripts_styles_cdn_urls() {
wp_enqueue_script('localScroll', '//cdnjs.cloudflare.com/ajax/libs/jquery-localScroll/1.4.0/jquery.localScroll.min.js');
wp_enqueue_script('scrollTo', '//cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/2.1.2/jquery.scrollTo.min.js');
}
add_action( 'wp_enqueue_scripts', 'enqueue_scripts_styles_cdn_urls' );
//* Enqueue scripts and styles from local files
function enqueue_scripts_styles_local_files() {
wp_enqueue_script( 'localScroll', get_stylesheet_directory_uri() . '/js/jquery.localScroll.min.js', array( 'localScroll' ), '1.4.0', true );
wp_enqueue_script( 'scrollTo', get_stylesheet_directory_uri() . '/js/jquery.scrollTo.min.js', array( 'scrollTo' ), '2.1.2', true );
}
add_action( 'wp_enqueue_scripts', 'enqueue_scripts_styles_local_files' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment