{"id":38450,"date":"2014-11-24T09:16:18","date_gmt":"2014-11-24T14:16:18","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=38450"},"modified":"2017-12-21T08:29:41","modified_gmt":"2017-12-21T13:29:41","slug":"wordpress-how-to-change-google-map-location-api-based","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/wordpress-how-to-change-google-map-location-api-based.html","title":{"rendered":"WordPress. How to change Google map location (API based)"},"content":{"rendered":"<p>\r\n<\/p>\r\n<p>This tutorial will show you how to change Google map location (API based) in WordPress templates.<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=XRWWO-NJ4FI?width=1280&amp;height=720\" rel=\"prettyPhoto\">WordPress. How to change Google map location (API based)<\/a><\/p>\r\n<div class=\"inline-banner\">\r\n<a href=\"https:\/\/www.templatemonster.com\/service-center\/\">\r\n<img src=\"\/help\/files\/banners\/inline\/Banner-3-(835-x100).jpg\" \/>\r\n<\/a>\r\n<\/div>\r\n<p>This map is usually embedded into Home page using shortcode <strong>[google_api_map]<\/strong>: <\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based-300x203.jpg\" alt=\"WordPress_How_ to_ change_ Google_ map_ location_ (API_based)\" width=\"300\" height=\"203\" class=\"aligncenter size-medium wp-image-38452\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based-300x203.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based-150x101.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based.jpg 1000w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\r\n<ol>\r\n<li>\r\n<p>To change Google map location, you should edit <strong>custom-function.php <\/strong> file from <strong>wp-content\\themes\\themeXXXXX\\includes<\/strong> folder, where XXXXX is your theme number. You can use FTP or File manager to locate and access the file.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Open the file and find the following lines:<\/p>\r\n<pre class=\"brush:php\">if ( !function_exists('google_api_map_shortcode') ) {\r\n      function google_api_map_shortcode( $atts, $content = null ) {\r\n       extract(shortcode_atts(array(\r\n         'latValue'  => '36.1372008'\r\n        , 'lngValue'  => '-115.1743134,9'\r\n        , 'zoomValue'      => '8'\r\n        , 'custom_class'  => ''\r\n       ), $atts));\r\n<\/pre>\r\n<\/li>\r\n<li>\r\n<p>In order to change your Google map location, you should change <strong>latitude<\/strong> and <strong>longitude<\/strong>. Open  <a href=\"https:\/\/www.google.com\/maps\/preview\" target=\"_blank\">https:\/\/www.google.com\/maps\/preview<\/a> and find your location. Right-click a place or area on the map, select <strong>What&#8217;s here?<\/strong> and coordinates will appear in the search box at the top of the page:<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based_1.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based_1-300x165.jpg\" alt=\"WordPress_How_ to_ change_ Google_ map_ location_ (API_based)_1\" width=\"300\" height=\"165\" class=\"aligncenter size-medium wp-image-38453\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based_1-300x165.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based_1-150x82.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based_1.jpg 987w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based_2.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based_2-300x174.jpg\" alt=\"WordPress_How_ to_ change_ Google_ map_ location_ (API_based)_2\" width=\"300\" height=\"174\" class=\"aligncenter size-medium wp-image-38454\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based_2-300x174.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based_2-150x87.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/10\/WordPress_How_-to_-change_-Google_-map_-location_-API_based_2.jpg 943w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>Then edit <strong>custom-function.php<\/strong> file and change default coordinates with yours. Save changes to the file and re-upload it to the server overwriting the existing one.<\/p>\r\n<\/li>\r\n<li>\r\n<p>You can also change <strong>zoom<\/strong> option value or add custom CSS class for your map.<\/p>\r\n<\/li>\r\n<\/ol>\r\n<p>Feel free to check the detailed video tutorial below:<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=XRWWO-NJ4FI?width=1280&amp;height=720\" rel=\"prettyPhoto\">WordPress. How to change Google map location (API based)<\/a>\r\n<\/p>\r\n<\/p>\r\nYou can use this tip while creating your <a href=\"https:\/\/www.templatemonster.com\/category\/real-estate-wordpress-themes\/\">WordPress real estate website<\/a> fast and simple. Don&#8217;t hesitate to check out!\r\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>This tutorial will show you how to change Google map location (API based) in WordPress templates.<\/p>\n","protected":false},"author":54,"featured_media":40687,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[728],"tags":[1102,929,1113,2405],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/38450"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/54"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=38450"}],"version-history":[{"count":3,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/38450\/revisions"}],"predecessor-version":[{"id":83610,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/38450\/revisions\/83610"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/40687"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=38450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=38450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=38450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}