I tried this : http://themes.simplethemes.com/skeleton/tutorials/how-to-add-custom-css-and-javascript-using-a-child-theme/
And I added this in my functions.php inside my child theme directory :
function my_custom_javascript() {
wp_enqueue_style('additional', get_stylesheet_directory_uri().'/js/additional.js', array('jquery'), '1.0', 'screen, projection');
}
add_filter('child_add_javascripts','my_custom_javascript');
Of course I have created the file skeleton_childtheme/js/additional.js
but it doesn't do anything and my additional.js is not loaded. Any idea? :(
wp_enqueue_script( 'vantage-bg' , get_template_directory_uri() . '/js/dynamicbg.js', array('jquery'), SITEORIGIN_THEME_VERSION );
Use this format, name for your script, directory, location of the file , dependency , and the theme name
add_action('wp_enqueue_scripts', 'load_javascript_files');
function load_javascript_files() {
wp_register_script('additional', get_stylesheet_directory_uri() . '/js/additional.js', array('jquery'), true );
wp_enqueue_script('additional');
}
did the trick.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.