Why is my function not working?
-
I’m trying to load up two JS files to just my template file ‘contact.php’. The function below isn’t working (its located in my functions.php file):
function google_map_script() { // register your script location, dependencies and version wp_register_script('maps_script', 'http://maps.googleapis.com/maps/api/js?sensor=false', array('jquery') ); wp_register_script('gmap_script', get_template_directory_uri() . '/js/gmap.js', array('jquery') ); // enqueue the script wp_enqueue_script('maps_script', 'gmap_script'); } if ( is_page_template( 'contact.php' ) ) add_action('init', 'google_map_script');
I’d appreciate any pointers or help at all 🙂
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Why is my function not working?’ is closed to new replies.