1. Home
  2. ReHub Theme
  3. Configuring Locators

Configuring Locators

For most of locators functions we use one of best Geo plugins for wordpress – Geo My WordPress

What you can do with plugin? There are some examples

  1. Add location to your products, so, buyers can search products in their area
  2. Add location to stores, so, buyers can search stores in their area
  3. Add location to directory posts.
  4. Auto detection of user location (based on google map API)

After installing plugin, you need to enable extensions in Geo My WP – Extensions: Post Locator if you need locators for directory or products, Member Locator if you need store/user locator, and Single Location (for both). Member Locator works only with Buddypress, so, if you need Store Locator you must also have enabled Buddypress plugin on site, because Stores in all multivendor plugins are based on Members.

Then, go to Geo My WP – settings and add your own Google API keys and Post types (if yo need Post locator)

Please, note, if you want to make auto detection of user location, your site must be on https:// (ssl), because google requires this for auto detecting of user location

Form Setup

Next thing, you need to create form for Member locator (if you need store or user locator) or for Post Locator if you need locator for directory posts or products.

In form settings, one thing which you need to understand is that plugin has two areas: Form and Results. In Form – you set how plugin will show locator form when page is loaded. On Results – you can configure how plugin will show results after user click on Search button. Lets’ check each setting tab. They are both the same for Post locator and Member Locator with only some differences

Page Load Results

On this setting tab I usually change only two options:

 Enable Page Load Features  – this option enable displaying results before searching. This means that you will see all available results before searching. If you want to show only form on one page (for example, on homepage) and then show search results on another page – disable this option. With this option, you should also enable option  Display list of results  and  Display Map  to show also map before results.

Also, you can choose in this page Post types which you want to include, initial position of map, units and other things which are optional

Search Form

Here, you can choose how to show form design

 Search Form Template choose here design of form. Our theme has custom forms for plugin to give you best results. All theme’s forms have name which starts from Custom:

Don’t use default form design as they don’t fit with theme

 Taxonomies  or  Xprofile Fields 

Here you can choose to show categories in form. If you use Product Locator, you can choose here all global attributes which you can create in Products – Attributes. Also you can choose categories. For Member Locator you can choose Xprofile fields (it’s the same as categories, but for users/stores). You can read how to use Xprofile fields in article If you are interesting in advanced using of Buddypress with theme, you can check our article about Buddypress

When you use member locator and Xprofile fields, you can choose design of form with xprofile fields (which will be all visible in form) or without Xprofiles (in this case, Xprofile fields will be visible only on clicking button “show options”)

 Address Field 

Here you can choose how to show address field. Usually I enable Address Autocomplete and Locator Button checkbox and nothing more.

 Locator Button 

Make it as empty, because locator icon is already enabled in previous option. Also, I recommend to make empty placeholders

Then, you can also choose units and other things which are optional

Form Submission

In this setting you can choose what will happen when user click on Submit button.

 Results Page  – you can choose “same page” which is default option, then, results will be available on the same page. You must also choose to show results and map in Page Load Setting which we described above. If you want to show results on separate page, choose page from dropdown. Then, on this page, you must have two shortcodes in content. Example

[gmw map=3]

[gmw form="results"]

In map=3 you should place Id of your form. You can see ID of your form in Geo My WP – Forms. Making results page as separate page can give you more control how to show results, because you can wrap shortcodes in different design containers, see details below for some examples

Also, On this settings I recommend you to enable Display list of results and Display Map

Search Results

Here you can choose template for results

As in previous step, you should choose templates which have  “Custom:”  in name. We added several templates. Some templates have 3 col or 4 col. It’s made because you can use Search results and Locators on Full width page or on page with sidebar, so, full width pages are better with 4 columns

All other options on this setting page will be ignored in theme’s templates, because we have custom output. Only one option which you can enable is  Directions Link 

Map

You can choose how to show map and it’s height. All is optional, you can leave as is

Form Usage

On this page you can copy shortcodes which you will use on pages to generate forms. Let’s see what we can use

How to Assign location

Post, product location can be added directly in Post and Product by admin. You can find special section for this in post.

Frontend Submit for Location

If you want to add option to assign Location to product for your vendors, we recommend to use WCFM plugin for vendor registrations. This is only one multivendor plugin which has inner support for Geo My WordPress. Once you enable both plugins, vendor can simply assign location when he create product.

If you use any type of Frontend Submit with our RH Frontend PRO plugin, you can synchronize map field of plugin and GMW. For this, add custom field to frontend form and set it’s key name as

medafi_rhmap

Set also this type of key as Address field

To make map field working as expected, you must add also google map API keys in settings of plugin

Auto Assign Location based on Member Location

This is one of useful function which we added to theme. If your user has Location in Member Location and submit product, you can enable auto assign of his location to post/product location. So, all his products will be marked with his location and he doesn’t need to add location to products each time. This is also useful when you have multi vendor site and you want to make Product Locator.

To enable this option – go to  Theme option  Shop settings  –  Synchronize product and user location? 

Member Location

All users can add own location inside their Profile of Buddypress. Don’t forget that you must have Member Locator Extension and Buddypress

Vendor Location

If you use one of supported Vendor plugin (WCFM, Dokan or WC Marketplace), vendors can assign location also inside their vendor dashboard, so, they don’t need to go to User profile for this. It’s useful because vendors can set everything from one dashboard. You can see vendor setup guide

Each vendor plugin has own fields for location, so, logic is a different for each plugin

WCFM – best plugin with integration for Geo My WordPress. Vendors can assign their location in map field in vendor dashboard.

Dokan – Dokan has Map selection inside vendor dashboard. If user adds location, theme will synchronize it also with GMW plugin. Important thing – Dokan has also text fields for address. These fields are just text, they will be visible in his profile as text, but not as map location. Only Map select will add real Location data to vendor. Also, Dokan PRO version has own Geolocation module which you can use.

WC Marketplace – the same as Dokan, plugin has map selection in vendor dashboard. By default, if vendor adds map location of his shop, map will be visible on separate tab. You can also show map inside widget. Go to appearance – widgets and add widget “vendor store location” in widget area Vendor Store Page sidebar

You can also show locator submit form on site to any page with shortcode

[rh_add_map_gmw]

Synchronize Vendor Location to his Products

If you want to add locations to Products of vendor when he submit product, you can enable automatic synchronization. Read how to do this

Usage of Locator Forms

After setting form, you can copy shortcode and place it on page. Usually, I use form shortcodes in content of page or in sidebar. Let’s see some examples

Using form and results on the same page

Demo

Here we use Display map and results on the same page in form settings. We use Custom: Simple form template and Custom: Lists. Then, we copy shortcode of form, create simple page and place there shortcode. This is basic locator and very simple to use

Using form on home page and results on separate page

Demo

We created custom home page, made it with page builder. Check docs for page builder 

We will place search form on homepage, but results will be on another page. So, we created also blank Page for results.

Then, we created Form in GMW. We disabled option to show results on page load

In Form submission, we have chosen our page for search results and set to display map before list of results

Now, go to Form Usage and copy two shortcodes – one for Form and one for Results. You can also divide map from results (but in this case, on Form submission tab, choose to show map by shortcode only)


Now, place our form shortcode on Homepage and search results shortcode on our search results page.

Little tip. If you want to show map as full width, enable stretch option in Elementor’s section where you placed map shortcode

Advanced and ready template for Locator

We also created some advanced example how you can use GMW on page

Demo

Settings for form are next:

Now, create new page with Elementor and just Import ready Page “Locator”. Don’t forget to replace ID in gmw shortcodes to ID of your form which you can find in Form Usage tab.

Also, notice, that Elementor doesn’t show shortcode output in shortcode module (you must click on Apply button for this). So, we recommend to preview page to see how it will look.

How to show map inside Post or Product

First of all, don’t forget to enable Single Location addon in Geo my WP – extensions.

Now, you can use next shortcode

[gmw_single_location object="post" map_height="300px" map_width="100%" elements="distance,map,address,directions_link"]

Check list of all available parameters

You can place this shortcode inside content of product. But also, you can show it globally. For this, use our RH Woo Tool plugin to add Custom tabs and add map inside tabs