dongzhouzhang8696 2016-09-29 10:31
浏览 31
已采纳

WP排队Google Maps API语法错误[重复]

This question already has an answer here:

I'm using the theme Sage from Roots.

/**
 * Theme assets
 */
function assets() {
  wp_enqueue_style('sage/css', Assets\asset_path('styles/main.css'), false, null);

  if (is_single() && comments_open() && get_option('thread_comments')) {
    wp_enqueue_script('comment-reply');
  }

  wp_enqueue_script('sage/js', Assets\asset_path('scripts/main.js'), ['jquery'], null, true);
  wp_enqueue_script('extras', Assets\asset_path('scripts/extras.js'), [], null, true);

  wp_enqueue_script('google-maps', '//maps.googleapis.com/maps/api/js?key=MY_API_KEY&callback=initMap' ), [], null, true);
}


add_action('wp_enqueue_scripts', __NAMESPACE__ . '\\assets', 100);

The first two instances of wp_enqueue_script work fine but after I added the google maps API, I get:

Parse error: syntax error, unexpected ',' in /srv/www/***/current/web/app/themes/*********/lib/setup.php on line 106

Line 106 is the google maps line. Where is the extra comma? I know that it isn't a typo futher up/down in the script because if I remove the maps API part, it works as expected.

</div>
  • 写回答

1条回答 默认 最新

  • dsa5211314 2016-09-29 10:42
    关注

    In this line

    wp_enqueue_script('google-maps', '//maps.googleapis.com/maps/api/js?key=MY_API_KEY&callback=initMap' ), [], null, true);
    

    Your brackets don't match up

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c