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/
Check to be sure you have the following plugins installed before you get started.
Home page should go to
Choose where links to the home page should redirect.
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.
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.
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)
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
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.
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.
Each location has a set of fields where you can add information specific to that location.
The Meta Title of the page for this location.
The Meta Description of the page for this location.
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:
In this example this is the City of Maple Shade
Location Description widget showing on the location page.
The featured image for the location.
The tagline for the featured imaged.
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
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.
GD > Location Switcher
GD > Listings
[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.
[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.
For more about customizing with CSS and PHP snippets see the doc about customizing.
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 and Category + Location pages have location data available that can be used in other ways.
Examples of pages/URLs with location data include:
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 then
if you are on /country/region/page then
if you are on /country/page then
geodir_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 on our forum, fnd out more here: https://wpgeodirectory.com/docs-v2/v2/support/
How can I translate the country slug?
See this document: https://wpgeodirectory.com/docs-v2/translation/country/
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.