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('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', '//' ), [], 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.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dsa5211314
    dsa5211314 2016-09-29 10:42

    In this line

    wp_enqueue_script('google-maps', '//' ), [], null, true);

    Your brackets don't match up

    点赞 评论