Using the shortcode
While the free version of Google Maps Widget allows you to display a map in any sidebar within your active theme, the PRO version allows you to use shortcodes as well. By using an automatically generated shortcode, you can easily display your custom map anywhere on the site.
The Shortcode:
If you have already created a widget, the shortcode has been created as well:
- Navigate to Appearance -> Widgets
- Find the GMW widget where you have created your map
- Open the widget and find the fourth, Shortcode tab
- Copy the shortcode which will look something like this:
[gmw thumb_width="620" thumb_height="620" id="1"]
Now you can use the shortcode to display the map anywhere in your posts, pages or in any WordPress template.
Please note that your theme might style the widget in the post as if it is placed in a sidebar. In that case, use the div.gmw-shortcode-widget
class to target the shortcode and make necessary changes via CSS.
Use the shortcode in templates:
To use the shortcode in a post or a page, it will be enough to copy and paste it in the editor. But if you want to use the shortcode in template files (for example, footer.php file), you will have to add additional code in order to execute it:
-
- Open footer.php file or any other template file
- Copy and paste the following code:
<?php echo do_shortcode('[gmw thumb_width="620" thumb_height="620" id="1"]
'); ?>
- Replace the widget ID with the one from your own shortcode
- Save changes
Using the hidden sidebar:
This sidebar will allow you to customize your map so that you can only use it with shortcode. A hidden sidebar won’t display your map as a widget. If you don’t need one, you can always remove it from the admin area.
- Navigate to Appearance -> Widgets
- Locate the Google Maps Widget PRO hidden sidebar
- Drag the GMW widget to the hidden sidebar
- Customize the map
- Open the fourth, Shortcode tab
- Copy and paste the shortcode where you want to show the map
*Please note that a shortcode can be used only once per posts/page. If you want to show multiple maps on one page, you will have to create additional widgets and use different IDs in shortcodes.
Documentation didn't help? Contact support!
Customers who purchased and have a valid PRO license, those who donated or are on trial - contact our support via email. Either email us from the address you used when purchasing, or include your license key in the email. This speeds things along.
Using the free version? We have you covered too. Head over to the forums. First look at older threads and if you don't find anything useful open a new thread. Support is community-powered so it can take some time to get an answer. If you need premium support this second - upgrade to PRO.