Last active
December 23, 2015 15:39
-
-
Save scottnix/6656585 to your computer and use it in GitHub Desktop.
Example of loading scripts from Child Theme
This file contains 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
// 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