1. Home
  2. Docs
  3. Integrations
  4. Maps




Maps! Maps! Maps Everywhere!

In this page we cover some of the awesome things you can do with maps when you use GeoDirectory.


GD Map Element

Add maps to your site with the GD Map block. As with all GeoDirectory design elements you can use a Widget, Shortcode, or Gutenberg block.

Map Type

GeoDirectory V2’s GD Map element has a setting called type. This setting has three options

  1. Auto – GeoDirectory will automatically switch the map type setting based on the GeoDirectory page type where it is shown.
  2. Directory – can show post type selector, category filter. Most often used on Location page. Also good choice for individual WP Pages.
  3. Archive – For use in the Archive and Search page templates. When shown in an archive or search page this map type will automatically display the listings that are shown in GD Loop on that archive page.
  4. Post – For the Detail page to show a single post id on the map. Can also be used in an individual page to show a map point when a listing ID is specified.

Page Design and Map Type

Let’s look at it the other way around. If you are working on a specific page template, which map type to select?

  • Location – Directory map. Location pages can show multiple post types with GD Listings, so, use a directory map and adjust the options to show the the post type selector and category filter.
  • Archive or Search – Archive map. Archive maps show the results from GD Loop (not GD Listings). You can also use all_posts=1 to show ALL posts of the active CPT.
  • Detail – Post map.

General Map Options

These options are shown as soon as you start configuring the GD Map element.
The default shortcode is [gd_map width="100%" height="425px" maptype="ROADMAP" zoom="0" map_type="auto" post_settings="1"]

  • Title – title="My Title" Set an optional title for the element.
  • Width – width="100%" Width of the map in % or px. When set to 100% the map will expand to fill the container in which it is placed.
  • Height – height="425px" The height of the map in %, px, or vh.
  • Mapview – maptype="ROADMAP" the type of map view that will be used by default.
  • Zoom – The zoom level. You can experiment with different values. Auto is recommended and will set the zoom automatically to show all the listings within the area of the element.
  • Map Type – map_type="auto" Select which type of map to be displayed. Auto is recommended.
  • Enable mouse scroll zoom? – scrollwheel="1" – Allows scrollwheel users to scroll the map.

Directory Map Options

Post Type Filter –
Display a map. Use the Directory map type on pages that may display more than one listing Custom Post Type. This pay type should be used on the Location page template.
cat_filter="1" shows the category filter for the current post_type displayed on the map.

post_type="1" for directory maps shows the Custom Post Type Select options at the bottom of the map.

Use the Archive map type for pages that will only display one listing Custom Post Type. This map should be used on the archive template page and the search page, as we as most non-GD pages like a WordPress page with a map of listings.Use the Post map type for display on the detail page.

Location Map

With GDV2 it is possible to create a map that shows listings from a particular location. This feature works the same for GD Map as for GD Listings, the idea being that you can show a map and listings together on a WordPress page.

To use this feature you must know the ‘slugs’ for the location. You can find these on a location page or a detail page.

For example: http://myawesome site.com/places/indonesia/west-java/bogor/forest-and-jungle-planting/awesome-jungle-planter-people

The slugs here are:

country: indonesia
region: west-java
city: bogor

Now add these to t he GD Map element like so:

(If the location fields are not visible, make sure to adjust the map type value to Directory or Archive map types).

GD Post Directions

The GD Post Directions element can be used in the Detail or Archive item template, or as a widget on the detail page for a CPT that has a physical location.

The output is a link to the maps service. The link uses the lat/lon of the listing location.

GD Post Directions shows a link.

GD Post Address

Get Support

Get support on our forum, find out more here: https://wpgeodirectory.com/docs-v2/geodirectory/support/

FAQ – Frequently Asked Questions

Override GD Details Tab Default Map

Be default the map shown on the detail page, the one that is in the tabs, that map uses the GD Map element with the option “Use post map zoom and type?” enabled. That means that whenever a user enters the add listing form and adjusts the map zoom, that zoom level is saved with the listing and used to determine the zoom of the map on the tab (or any other map shown on the page with the option enabled).

So, want to change that?

To override the default settings of shortcodes used in tabs you have to:

Go to the tabs UI for the CPT
Remove the tab
Add a new tab (using the fieldgroup)
Add a new shortcode field to that tab
Include a GD Map shortcode that has the options you want (like turning off that option above)

You might want to use a shortcode like this one:
[gd_map width="100%" height="425px" maptype="ROADMAP" zoom="14" map_type="post" post_settings="0"]

What you don’t want is post_settings="1" because that will use the zoom settings of the user doing the input.

Was this article helpful to you? Yes No 1