You can attach as many locations as you want to a listing. Adding listings based on location is a very common feature of a directory site. You can create unlimited locations using the Directorist plugin.
Adding a listing Location
You can create a listing location in two ways: 1. From Directorist Listings > Add New Listing page while adding a listing, 2. From Directorist Listings > Directorist Locations page. The main difference between these two places regarding adding a location is that you will be able to an image to any locations in the Directorist Locations page while you can not do the same in the Add New Listing page. This is why we recommend creating all listing locations from the Directorist Locations Page.
Go to Directorist Listings > Directorist Locations page and give a name to your chosen location. Adding a slug is optional as WordPress will generate this from the name field automatically. Choose a parent location if you want to organize by a parent-child hierarchy. The description field is optional. You may add an image to a location by clicking the ‘Add Image’ button on that page. The location image will be visible only on the page with the shortcode [directorist_all_categories] and Grid view is active(You can display locations in grid or list, keep reading to learn more about them). Once you have created the number of locations you wanted, you can assign them to any listing during adding a listing either from the front-end or the backend dashboard.
Displaying all listing Locations
You can display all listings locations using the shortcode [directorist_all_locations]. Use this shortcode inside any page content to display all categories in a single place.
Customizing the options of directorist locations
You can also customize how the locations are displayed in the location archive page very easily.
Go to Directorist Listings > Directorist Settings > Categories & Locations Page tab. Customize any options in the location section according to our need and save the changes. Visit the listing location archive page and you should see the changes have taken effect. Check out the screenshot below for a visual guide.
A quick overview of all locations options
- Default View: It lets you customize how to display all listings locations in the archive page. Available options are Grid and List.
- Number of Columns: You can display all locations in your desired number of columns using this option. Accept values: Number/integer.
- Sub-location Depth: When displaying all locations in a list-view, you can decide the number of the depth of sub-locations to display under a parent location. Accept values: Number/integer.
- Locations Order By: You can fetch and display all locations by an order. You can order them by ID, Count, Name or Slug.
- Locations Sort By: You can sort the locations either by ascending or descending order using this option.
- Display Listing Count: You can display the number of listings attached to each location using this option. Default is Yes.
- Hide Empty Locations: This option lets you hide any location that does not have any listings attached to it.
Displaying locations widget in a sidebar
You can display all listings locations using the Directorist – Locations Widget. You can use this widget from Appearance > Widgets page. Drag the Directorist – Locations widget to a sidebar eg. the Directorist – Listing Right Sidebar and customize the widget settings. Click save after customizing the widget and visit any listing details page. You will see locations are being displayed perfectly. Check out the screenshots below for more visual understanding.
If you rather prefer a video guide, check out our following quick video walkthrough.