Categories

Featured templates

WordPress. How to change Google map location (API based)

Kate Daniels November 24, 2014
Rating: 5.0/5. From 1 vote.
Please wait...

This tutorial will show you how to change Google map location (API based) in WordPress templates.

WordPress. How to change Google map location (API based)

This map is usually embedded into Home page using shortcode [google_api_map]:

WordPress_How_ to_ change_ Google_ map_ location_ (API_based)

  1. To change Google map location, you should edit custom-function.php file from wp-content\themes\themeXXXXX\includes folder, where XXXXX is your theme number. You can use FTP or File manager to locate and access the file.

  2. Open the file and find the following lines:

    if ( !function_exists('google_api_map_shortcode') ) {
          function google_api_map_shortcode( $atts, $content = null ) {
           extract(shortcode_atts(array(
             'latValue'  => '36.1372008'
            , 'lngValue'  => '-115.1743134,9'
            , 'zoomValue'      => '8'
            , 'custom_class'  => ''
           ), $atts));
    
  3. In order to change your Google map location, you should change latitude and longitude. Open https://www.google.com/maps/preview and find your location. Right-click a place or area on the map, select What’s here? and coordinates will appear in the search box at the top of the page:

    WordPress_How_ to_ change_ Google_ map_ location_ (API_based)_1

    WordPress_How_ to_ change_ Google_ map_ location_ (API_based)_2

  4. Then edit custom-function.php file and change default coordinates with yours. Save changes to the file and re-upload it to the server overwriting the existing one.

  5. You can also change zoom option value or add custom CSS class for your map.

Feel free to check the detailed video tutorial below:

WordPress. How to change Google map location (API based)

You can use this tip while creating your WordPress real estate website fast and simple. Don’t hesitate to check out!

Best Creative Wordpress Themes
This entry was posted in WordPress Tutorials and tagged api, google, map, WordPress. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket