目前我正在 header.php 中以这种方式加载 google map api 3 java 脚本:
<body onload="initialize()" class="home page page-id-13 page-template page-template-page-FullWidth-php u-design-responsive-on u-design-menu-drop-shadows-on top-bg-color-dark ">
但是,这会在每个页面上加载 initialize(),这很糟糕。我希望它只加载在主页上,像这样(不起作用):
<body <?php if(is_home()) { echo 'onload="initialize()"'}; body_class( array ($udesign_options['enable_cufon'], $udesign_responsive_body_class, $udesign_menu_auto_arrows, $udesign_menu_drop_shadows) )?>
非常感谢!