0

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? :(

Gaston Flanchard
  • 519
  • 1
  • 5
  • 15

2 Answers2

0

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

0
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.

Gaston Flanchard
  • 519
  • 1
  • 5
  • 15