{"id":186093,"date":"2016-01-25T00:31:14","date_gmt":"2016-01-24T15:31:14","guid":{"rendered":"https:\/\/ja.wordpress.org\/support\/2016\/01\/25\/google-api%e3%81%ae%e5%88%a9%e7%94%a8\/"},"modified":"2016-09-28T06:10:11","modified_gmt":"2016-09-27T21:10:11","slug":"google-api%e3%81%ae%e5%88%a9%e7%94%a8","status":"closed","type":"topic","link":"https:\/\/ja.wordpress.org\/support\/topic\/google-api%e3%81%ae%e5%88%a9%e7%94%a8\/","title":{"rendered":"Google API\u306e\u5229\u7528"},"content":{"rendered":"<p>\u521d\u3081\u307e\u3057\u3066\u3002<br \/>\nWordpress\u306e\u30d7\u30ea\u30bb\u30c3\u30c8\u30c6\u30fc\u30de\u3067\u5b50\u30c6\u30fc\u30de\u3092\u4f5c\u6210\u3057\u3001\u305d\u3053\u306bGoogle Map API\u3092\u3067\u5730\u56f3\u3092\u63cf\u753b\u3057\u3088\u3046\u3068\u3057\u305f\u306e\u3067\u3059\u304c\u52d5\u4f5c\u304c\u4e0d\u53ef\u89e3\u3067\u539f\u56e0\u3092\u8abf\u3079\u3066\u3044\u307e\u3059\u3002\u307f\u3055\u306a\u3093\u306e\u77e5\u6075\u3092\u304a\u501f\u308a\u3057\u305f\u3044\u3067\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u5b9f\u88c5\u3057\u305f\u3068\u3053\u308d\u3001Google\u30de\u30c3\u30d7\u306e\u57fa\u672c\u7684\u306a\u30d1\u30fc\u30c4\u306e\u8868\u793a\uff08\u5de6\u4e0a\u306e\u5207\u308a\u66ff\u3048\u8868\u793a\u30bf\u30d6\u3001\u5de6\u4e0b\u306eGoogle\u306e\u30ed\u30b4\u3001\u53f3\u4e0b\u306e\u30a8\u30e9\u30fc\u30ec\u30dd\u30fc\u30c8\u306a\u3069\u3078\u306e\u30ea\u30f3\u30af)\u306f\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3059\u304c\u809d\u5fc3\u306e<strong>\u5730\u56f3\u306e\u5185\u5bb9\u3060\u3051\u304c<\/strong>\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002<br \/>\n\u78ba\u8a8d\u3057\u305f\u3053\u3068\u3068\u3057\u3066\u306f\u3001<\/p>\n<ul>\n<li>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u4e2d\u3067\u3082iframe\u30bf\u30b0\u3092\u7528\u3044\u305f\u5b9f\u88c5\u3057\u305f\u5834\u5408\u3067\u306f\u6a5f\u80fd\u3057\u307e\u3059\u3002<\/li>\n<li>Google Developper Console\u304b\u3089\u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3069\u3046\u3084\u3089\u901a\u4fe1\u306f\u6210\u529f\u3057\u3066\u3044\u308b\u3002<\/li>\n<li>\u30e2\u30b8\u30e5\u30fc\u30eb\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u307e\u305a\u3001\u8a72\u5f53\u306e\u5b50\u30c6\u30fc\u30de\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u4f5c\u6210\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u306f\u6a5f\u80fd\u3059\u308b\u3002<\/li>\n<li>PHP, Javascript, Google Map API\u3067\u306e\u30a8\u30e9\u30fc\u306f\u78ba\u8a8d\u3067\u304d\u306a\u3044\u3002<\/li>\n<\/ul>\n<p>\u3053\u306e\u30c6\u30fc\u30de\u4e2d\u3067\u306fgoogle\u306eAPI\u3092\u4f7f\u3063\u3066font\u306e\u30c7\u30fc\u30bf\u3092\u53c2\u7167\u3057\u3066\u3044\u308b\u3088\u3046\u3067\u3001\u305d\u308c\u304c\u539f\u56e0\u306a\u306e\u304b\u3068\u3042\u305f\u308a\u3092\u3064\u3051\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u3069\u3046\u3059\u308c\u3070\u826f\u3044\u306e\u304b\u3002\u3002\u3002<br \/>\n\u307f\u306a\u3055\u3093\u306a\u3089\u3069\u3046\u539f\u56e0\u3092\u7279\u5b9a\u3057\u307e\u3059\u304b\uff1f\u3042\u307e\u308a\u52a9\u9577\u306b\u306a\u3063\u3066\u306f\u306a\u3089\u306a\u3044\u3068\u601d\u3044\u4ee5\u4e0b\u306e\u5185\u5bb9\u306b\u7d5e\u308a\u307e\u3057\u305f\u304c\u3001\u4ed6\u306b\u5fc5\u8981\u306a\u60c5\u5831\u304c\u3042\u308c\u3070\u304a\u3063\u3057\u3083\u3063\u3066\u304f\u3060\u3055\u3044\u3002\u3054\u52a9\u529b\u3001\u3069\u3046\u305e\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3044\u305f\u3057\u307e\u3059\u3002<\/p>\n<p>[\u74b0\u5883]<\/p>\n<ul>\n<li>WordPress Ver.:4.4.1<\/li>\n<li>\u4f7f\u7528\u30c6\u30fc\u30de\uff1aTwentythirteen1.7\u306e\u81ea\u4f5c\u5b50\u30c6\u30fc\u30de<\/li>\n<li>\u30d6\u30e9\u30a6\u30b6:Safari 9.0.2 \/ Firefox 42.0<\/li>\n<li>\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067\u306e\u958b\u767a<\/li>\n<\/ul>\n<p>[front-page.php]<\/p>\n<pre><code>&lt;?php get_header();?&gt;\n&lt;div id=&quot;map&quot;  style=&quot;height:100%; width:100%;&quot;&gt;&lt;\/div&gt;&lt;br \/&gt;\n&lt;?php get_footer();<\/code><\/pre>\n<p>[functions.php]<\/p>\n<pre><code>&lt;?php\nadd_action( &#039;wp_enqueue_scripts&#039;, &#039;theme_enqueue_styles&#039; );\nfunction theme_enqueue_styles() {\n    ...(\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u306e\u8aad\u307f\u8fbc\u307f)\n    wp_enqueue_script( &#039;google-api&#039;, &#039;https:\/\/maps.googleapis.com\/maps\/api\/js?key={\u53d6\u5f97\u6e08\u307fAPI KEY}&#039;, array());\n    wp_enqueue_script( &#039;map&#039;, get_stylesheet_directory_uri() . &#039;\/js\/map.js&#039;, array(&#039;google-api&#039;), &#039;1.0.0&#039;, true);\n}<\/code><\/pre>\n<p>[map.js]<\/p>\n<pre><code>function initMap() {\n  var latLng = new google.maps.LatLng({\u7def\u5ea6}, {\u7d4c\u5ea6});\n  var map = new google.maps.Map(document.getElementById(&#039;map&#039;), {\n    center: latLng,\n    zoom: 16,\n  });\n\n  var marker = new google.maps.Marker({\n    map : map,\n    position : latLng,\n  }) ;\n\n  var infoWindow = new google.maps.InfoWindow({\n    content : &#039;&lt;b&gt;{\u30d4\u30f3\u306b\u52a0\u3048\u308b\u30b3\u30e1\u30f3\u30c8}&lt;\/b&gt;&#039;,\n    position : latLng,\n  });\n\n  infoWindow.open(map, marker);\n}\n\ninitMap();<\/code><\/pre>\n<p>\u6b21\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u8a72\u5f53\u306e\u5b50\u30c6\u30fc\u30de\u306e\u30d9\u30fc\u30b9\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u4fdd\u5b58\u3057\u3066\u8aad\u307f\u8fbc\u3093\u3060\u5834\u5408\u306f\u6a5f\u80fd\u3057\u307e\u3059\u3002<br \/>\n[map.html]<\/p>\n<pre><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n    &lt;title&gt;Google Map API Test&lt;\/title&gt;\n    &lt;style&gt;\n        html, body { height:100%; }\n        #map {height:100%; width: 100%;}\n    &lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;div id=&quot;map&quot;&gt;&lt;\/div&gt;\n    &lt;script src=&quot;https:\/\/maps.googleapis.com\/maps\/api\/js?callback=initMap&quot; async defer&gt;&lt;\/script&gt;\n    &lt;script&gt;\n    function initMap() {\n        var latLng = new google.maps.LatLng({\u7def\u5ea6},{\u7d4c\u5ea6});\n        var map = new google.maps.Map(document.getElementById(&#039;map&#039;), {\n            center: latLng,\n            zoom: 16,\n        });\n\n        var marker = new google.maps.Marker({\n            map : map,\n            position : latLng,\n        }) ;\n\n        var infoWindow = new google.maps.InfoWindow({\n            content : &#039;&lt;b&gt;{\u30d4\u30f3\u306b\u66f8\u304d\u8fbc\u3080\u30b3\u30e1\u30f3\u30c8}&lt;\/b&gt;&#039;,\n            position : latLng,\n        });\n\n        infoWindow.open(map, marker);\n    }\n    intiMap();\n&lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-186093","topic","type-topic","status-closed","hentry","topic-tag-16252","topic-tag-google-api","topic-tag-google-map-api","topic-tag-javascript","topic-tag-api","topic-tag-23107"],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/186093","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/186093\/revisions"}],"wp:attachment":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=186093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}