Add enqueue_script code into functions.php
This commit is contained in:
parent
c0e24a4206
commit
c615a59e19
2 changed files with 9 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ function td_theme_styles() {
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'google-maps',
|
'google-maps',
|
||||||
'//maps.googleapis.com/maps/api/js?key=AIzaSyDHNT102YHu-TP50F78bPyvf5ia6K6cjU8&callback=initMap',
|
'//maps.googleapis.com/maps/api/js?key=AIzaSyDHNT102YHu-TP50F78bPyvf5ia6K6cjU8&callback=initMap',
|
||||||
array(),
|
array('page_pins_map'),
|
||||||
'1.0',
|
'1.0',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
@ -82,4 +82,11 @@ function atravelblog_related_posts() {
|
||||||
add_post_image_thumbs($urlaub, 'Urlaub:');
|
add_post_image_thumbs($urlaub, 'Urlaub:');
|
||||||
wp_reset_query();
|
wp_reset_query();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function enqueue_page_pins() {
|
||||||
|
// change the template file name according to your file
|
||||||
|
if ( ! is_page_template('page-pins.php') ) return;
|
||||||
|
wp_enqueue_script('page_pins_map', get_stylesheet_directory_uri() . '/js/page-pins-map.js', array('jquery'), null, true);
|
||||||
|
}
|
||||||
|
add_action('wp_enqueue_scripts','enqueue_page_pins');
|
||||||
|
|
@ -78,7 +78,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endwhile;
|
endwhile;
|
||||||
wp_enqueue_script('page_pins_map', get_stylesheet_directory_uri() . '/js/page-pins-map.js', array('jquery'));
|
|
||||||
wp_localize_script('page_pins_map', 'page_pins_map', array('places' => $locations, 'traveler' => $traveler));
|
wp_localize_script('page_pins_map', 'page_pins_map', array('places' => $locations, 'traveler' => $traveler));
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue