我在我的functions.php中有这个代码,它在我的页面源代码中显示了我的API密钥和map_script.js。
function google_maps_api() {
wp_register_script( 'googlemap', 'https://maps.googleapis.com/maps/api/js?key=MYAPIKEY&signed_in=true&callback=initMap',true);
wp_register_script( 'map-script', '/js/map_script.js',true);
if( is_page( 'To the Nations Worldwide' ) ) {
wp_enqueue_script('googlemap');
}
if( is_page( 'To the Nations Worldwide' ) ) {
wp_enqueue_script('map-script'); }
}
add_action( 'wp_enqueue_scripts', 'google_maps_api' );
这显示我的主页上的所有内容,位于www.tothenationsworldwide.com的页面源代码中,但地图未显示。
我已尝试在我的CSS中添加此内容
body,html,#map-canvas{
height:100%;
min-height: 100%;
width: 100%;
margin: 0px;
padding: 0px
}
这在我的页面上我希望地图显示
<script type='text/javascript' src='http://www.tothenationsworldwide.com/js/map_script.js?ver=4.3.1'></script>
<div id="map-canvas"></div>
没有运气,我需要知道接下来我需要做什么来展示我的地图。
谢谢!