Location Manager
Introduction
Installation
Settings
Location Data
Design
Support
FAQ – Frequently Asked Questions
Introduction
Your directory can use Location Manager to add listings to cities other than your default location. This is an important tool if you want your directory to include multiple cities.
See more here: https://wpgeodirectory.com/downloads/location-manager/
Installation
Preparation
Check to be sure you have the following plugins installed before you get started.
Installation
Settings
URL Settings
Home page should go to
Choose where links to the home page should redirect.
Archive urls
Choose whether or not the location should be added to the archive page URL.
Archive urls on listing page
Choose how the location should be added to the archive URLs on the listing page.
Enable locations
Choose the options for locations available to your site users.
- Enable Default – Users will not be able to change the option.
- Enable Multi – users can place the pin on the map, and new locations will be added as needed.
- Enable Selected – select specific locations to present as options to your users.
Enable neighborhoods?
If enabled, new neighborhoods can be added on the Cities tab.
Add listing form
Disable address autocomplete?
Some sites want to allow freeform entry of street address for the convenience of users. Select this option to disable autocomplete.
Show all locations in dropdown?
This is useful if you have a small directory but can break your site if you have many locations
Disable set address on map from changing address fields
This is useful if you have a small directory and you have custom locations or your locations are not known by the Maps API and they break the address. (highly recommended not to enable this)
Disable move map pin from changing address fields
This is useful if you have a small directory and you have custom locations or your locations are not known by the Google API and they break the address. (highly recommended not to enable this)
Change the Default Location
If you do not have the Location Manager installed, then you can set or change the default location in the settings at:
GeoDirectory – Settings – General – Default Location
Once the Location Manager addon is installed, that subtab option will disappear. Instead you can select from the cities in your location database to choose which one should be the default location.
To change the default location with the Location Manager addon installed:
- Visit GeoDirectory – Settings – Locations (tab) – Cities (subtab)
- Look for the default location column
- Select the radio button next to the city you want to be the default location
- Set the radio, and confirm the selection
If the default location you want does not yet exist, you can also add it from the same page. Once you have added it, it will appear in the list and you can set it as default.
Cities (subtab) – Add City
Remove Country and/or Region from Listing, CPT, and Location URLs
When your directory is using default country and/or region it is possible to remove country and/or region from some URLs.
To set this up configure the following options in the Locations tab advanced options.
Other
Load more limit
Load more locations after this count has been reached.
Disable term auto count?
On shared hosting with lots of listings, saving a listing may take a long time becasue of auto term counts, if you disable them here you should manually run the GD Tools > Location category counts, often until you can upgrade your hosting and re-enable it here, otherwise your location term and review counts can be wrong.
Location Data
Each location has a set of fields where you can add information specific to that location.
Meta Title
The Meta Title of the page for this location.
Meta Description
The Meta Description of the page for this location.
Location Description
Each location has a Location Description, so, there are lots of ways to add unique content by filling in each location description with unique content about the location.
Enter information about the location. The field supports HTML. This field is displayed with the Location Description Widget or Shortcode.
To enable shortcodes in this field, add this snippet:
add_filter('geodir_location_description', 'do_shortcode',10,1);
In this example this is the City of Maple Shade
Location Description widget showing on the location page.
Featured Image
The featured image for the location.
Image Tagline
The tagline for the featured imaged.
Add Location
Countries
Regions
Cities
Neighborhoods
Neighborhoods will also show up in the Near Search when autocomplete is enabled, as shown in the image below:
Merge and Delete Locations
In the cities subtab you can find links to edit your locations.
Design
Navigation
To add the “Change Location” feature to your menu:
- Open WordPress – Appearance – Menus
- Select the menu you want to edit
- Find and select GeoDirectory Endpoints in the menu options. (If you do not see it, then open Screen options in the top
- left and select it).
- Scroll to the bottom of GeoDirectory Endpoints to find Location Switcher
- Select Change Location and click “Add to menu”
- Save the menu
Widgets
GD > Location Description
Each location type has a Location Description field. Add your HTML into the Location Description field, and then use the widget to display that content to site visitors.
Widget Settings
GD > Location Switcher
GD > Listings
See: gd_listings
Shortcodes
[gd_location_description title="GD Location Description"]
This shortcode can be used on the location page template:
It shows the contents of the Location Description field. For example, here it is showing the Location Description for Maple Shade (City) on the location page for Map Shade city (/location/united-states/new-jersey/maple-shade).
[gd_location_switcher title="GD Location Switcher"]
[gd_locations title="GD Locations"]
Once Location Manager is installed, the gd_listings shortcode and widget both can be filtered for one location.
Example:
[gd_listings title="GD Listings Featured Places for Maple Shade Township" post_type="gd_place" show_featured_only="1" country="united-states" region="new-jersey" city="maple-shade-township"]
These are the additional options in the shortcode builder. Note here that the slugs used are for one city location, with the correct region and country slug to match that city location.
And the output
Note: This feature is not compatible with the “Enable Location Filter” which will further filter the results based on the location of the currently viewed page, most likely results in 0 results.
Merge Locations
Inside the lsit of countries/regions/cities you can use the checkbox to select two or more and then choose “merge” from the bulk actions dropdown.
Merging will give you the option to choose where listings should end up. You can merge 100 cities into one and it will move all the listings and change their city and region and country at the same time.
It is recommended to merge locations as a rule, and to avoid even considering deleting them. The reason is to avoid even the potential for deleting a location with listings because that will ‘orphan’ the listings.
Choose country/region/city subtab
Select one or more locations
From bulk actions choose merge
When the page reloads, choose the ‘destination’ location. All the listings will be merged into this location.
Done
Customize
For more about customizing with CSS and PHP snippets see the doc about customizing.
Topics
Example snippet to add region to the GD Search bar as a dropdown – Forum topic
Hide Near Field Suggestions
CSS Snippets to hide near search field suggestions, either all or only the IN suggestions: https://wpgeodirectory.com/support/topic/hide-all-in-locations-from-dropdown/#post-493566
Location Data
Location and Category + Location pages have location data available that can be used in other ways.
Examples of pages/URLs with location data include:
/location_page_slug/united-states/pennsylvania/phildelphia/ /cpt_slug/category_base/attractions/united-states/pennsylvania/phildelphia/
What follows are conditional PHP statements that can be used to retrieve the location data on those pages for use in your own customizations.
Examples:
geodir_is_page( 'location' ) – Determines whether current page is location page. geodir_location_get_current( 'location' ) – Current location. Current Country or Region or City or Neighbourhood. Depends on current location type. geodir_location_get_current( 'location_slug' ) – Current location. Current Country slug or Region slug or City slug or Neighbourhood slug. Depends on current location type. geodir_location_get_current( 'id' ) – Location id. Only if city is set. geodir_location_get_current( 'type' ) – Location type. One of from "country, region, city, neighbourhood, me, gps". geodir_location_get_current( 'is_default' ) – Is default location. Only if city is set. geodir_location_get_current( 'country' ) – Country name. Ex: United Kingdom. geodir_location_get_current( 'country_slug' ) – Country slug. Ex: united-kingdom. geodir_location_get_current( 'region' ) – Region name. Ex: Greater London. geodir_location_get_current( 'region_slug' ) – Region slug. Ex: greater-london. geodir_location_get_current( 'city' ) – City name. Ex: London geodir_location_get_current( 'city_slug' ) – City slug. Ex: london. geodir_location_get_current( 'neighbourhood' ) – Neighbourhood name. Ex: Camden Town. geodir_location_get_current( 'neighbourhood_slug' ) – Neighbourhood slug. Ex: camden-town. geodir_location_get_current( 'latitude' ) – Latitude. Only if city or neighbourhood or gps/me is set. Ex: 51.4587232758 geodir_location_get_current( 'longitude' ) – Longitude. Only if city or neighbourhood or gps/me is set. Ex: -0.1956555088
geodir_location_get_current( ‘location’ ) – Current location. Current Country or Region or City or Neighbourhood. Depends on current location type.
if you are on /country/region//city page thenCity name
if you are on /country/region/page then
Region name
if you are on /country/page then
Country namegeodir_is_page( ‘location’ ) == ‘Philadelphia’ – for name
similarly you can filter by geodir_location_get_current( ‘country’ ) or geodir_location_get_current( ‘region’ ) or geodir_location_get_current( ‘city’ )
if you want to do it by particular country/region/city
ex: geodir_location_get_current( ‘country’ ) == ‘United Kingdom’
ex: geodir_location_get_current( ‘country_slug’ ) == ‘united-kingdom’
geodir_location_get_current( ‘region’ ) == ‘Greater London’
geodir_location_get_current( ‘region_slug’ ) == ‘greater-london’
geodir_location_get_current( ‘city’ ) == ‘London’
geodir_location_get_current( ‘city_slug’ ) == ‘london’For an example of using an array, see this topic.
Get Support
Get support on our forum, fnd out more here: https://wpgeodirectory.com/docs-v2/v2/support/
FAQ – Frequently Asked Questions
How can I translate the country slug?
See this document: https://wpgeodirectory.com/docs-v2/translation/country/
How do I add my locations?
Locations should not be added manually.
In the case that you are starting a new directory and want to limit your directory to one region or country and perhaps several cities, here is how to go about setup:
- Visit the Locations tab and enable Multi Countries, Regions, and Cities
- Go to Places – Add New and add a listing in each of the Countries, Regions, and Cities that you want to use
- Return to the Locations tab and choose “Selected” Countries, Regions, and Cities, selecting for each the locations you want to use
Why can’t I add locations manually?
If you name the country/region/city even the slightest bit different from the Map API you are using, then a new country/region/city will be created instead of the one you are using. Locations with custom names must be maintained manually by merging new duplicate locations into them, thereby moving the listings in those locations into the manually created location.
How can I manage custom locations?
It is possible to manage custom locations with Location Manager.
The way you do it is to create your custom city location, and then merge other cities into that custom location.
See this part of the documentation above about editing locations
One of the issues with this approach is that the custom location is not returned by the map API, so, new listings will may be located in previously merged cities. For this reason custom locations is not a common solution. We do have plans to create an addon to make it easier to manage custom locations but we don’t have a timeline for that.