Skip to content

Instantly share code, notes, and snippets.

@scottnix
Last active December 23, 2015 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottnix/6656585 to your computer and use it in GitHub Desktop.
Save scottnix/6656585 to your computer and use it in GitHub Desktop.
Example of loading scripts from Child Theme
// thematictheme.com/forums/topic/correct-way-to-prevent-loading-thematic-scripts/
// remove built in drop down theme javascript
function childtheme_remove_superfish(){
remove_theme_support('thematic_superfish');
}
add_action('wp_enqueue_scripts','childtheme_remove_superfish', 9);
// script manager template for registering and enqueuing files
function childtheme_script_manager() {
// registers misc custom script, childtheme path, yes dependency is jquery, no version, loads in footer
wp_register_script('superfish-js', get_stylesheet_directory_uri() . '/js/superfish.js', array('jquery'), false, true);
wp_register_script('hoverintent-js', get_stylesheet_directory_uri() . '/js/hoverIntent.js', array('jquery'), false, true);
// enqueue the scripts for use in theme
wp_enqueue_script ('superfish-js');
wp_enqueue_script ('hoverintent-js');
}
add_action('wp_enqueue_scripts', 'childtheme_script_manager');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment