I'm trying to register & enqueue ImageMapster in my Skeleton Child Theme on the main.php page to make an image map with hovering image effects. I added this code to the "Header Functions" section of my child theme's functions.php file:
add_action( 'wp_enqueue_scripts', 'load_custom_js' );
function load_custom_js() {
wp_register_script( 'jquery.imagemapster.js',
get_template_directory_uri() . '/javascripts/jquery.imagemapster.js',
array('jquery'), '1.2.6', false );
if ( is_page('Main') ) {
wp_enqueue_script( 'jquery.imagemapster.js',
get_template_directory_uri() . '/javascripts/jquery.imagemapster.js',
array('jquery'), '1.2.6', false );
}
}
Now my site has ceased to work. The javascript file is located in the parent theme directory, so is it correct to use get_template_directory_uri instead of get_stylesheet_directory_uri? Does each theme have a particular place where one should add custom functions or am I correct in adding it under "Header Functions"? Any help would be appreciated.