If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)

captcha

Featured templates

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

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!