This topic has 2 replies, 2 voices, and was last updated 10 years, 8 months ago ago by Olga Barlow
Hi,
I want to add a bootstrap-style type ahead javascript file (http://twitter.github.io/typeahead.js/releases/latest/typeahead.bundle.js).
To add the library, Where should I insert the following code?
wp_register_script(‘typeahead’,get_template_directory_uri().’/assets/js/typeahead.bundle.js’,
array(‘jquery’), null, true);
wp_enqueue_script(‘typeahead’);
Thank you for your help.
Hello,
You should create child theme (https://www.8theme.com/demo/docs/leader/index.html#!/child_theme) and place following code into child theme functions.php:
function theme_name_scripts() {
wp_register_script(‘typeahead’,get_template_directory_uri().’/assets/js/typeahead.bundle.js’,
array(‘jquery’), null, true);
wp_enqueue_script(‘typeahead’);
}
add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
This article can be helpful http://codex.wordpress.org/Function_Reference/wp_enqueue_script
Tagged: javascript, leader, themes, woocommerce, wordpress
The issue related to '‘How to add js files to The Leader theme?’' has been successfully resolved, and the topic is now closed for further responses