1. Home
  2. Docs
  3. Plugin Features
  4. Business Directory
  5. Add Search Features

Add Search Features

How to add search feature to Business Directory

Search Form Shortcode

Activate search bar for Business Directory

Step 1: Create a search page

Display a Business Directory search form on your association’s website, by creating a new page and inserting the following shortcode: [business_search_form].

The page with the [business_search_form] shortcode will display your search form. You can put the [business_search_form] shortcode anywhere on the site (including a sidebar widget).

Step 2: Create a results page

Next, create a separate page to display the search results using this shortcode: [business_search_results].

NOTE: You must use these two pages in conjunction, but on separate pages.

Step 3: Connect the search page to the results page

Add the required parameter – results_page=”name-of-results-page” – to your [business_search_form] shortcode. (Replace ‘name-of-results-page’ with the slug of your search results page.)

For Example: If the title of your search results page is ‘Search Results’, then the slug is probably ‘search-results’, and the shortcode for your search form should look like this [business_search_form results_page="search-results"]

How to Find Page Slug: To get the slug, of that page, navigate to the page in your dashboard. Edit the page. On the right, look for ‘Permalink’ section. Here you will see the page slug. Or, you can get the slug by viewing the page, and finding the part of the URL that comes after the last “/”.


Add Directory Search Widget

There is also a Business Directory Search widget. To add a Directory search to a widget area on your site, you also need to have a page with the [business_search_results] shortcode in it.

add search widget for Business Directory

Search Results Page Display

By default, the search results page will display as a single column.  You can use responsive to create a multi-column display.  Columns will adjust based on page width. For example [business_search_results format="responsive"].

Search Business by Name

Using the search form your website visitors can search your Directory by Business category, keyword in the description or Business name. Keep in mind that if you have opted to ‘hide lapsed members‘ using the Member Manager plugin, Directory listings that have been marked ‘lapsed’ will not appear in search pages.

Search Results per Page

The default number of search results shown is 5. You can change this to show more results per page or fewer results per page under CDsettings >> Directory.

Add A-Z Search to Business Directory

All you need to do to add an A-Z search feature to your Business Directory is to add this parameter to your [business_directory] shortcode: alpha=”yes”

Scroll down to the video below for step-by-step instructions.

Search by Letter

Add A-Z search to Business Directory - Alpha Search

Category Quick Search

Search Directory by Category

You can use parent / child categories to add a responsive category display (as shown above) to your Directory. Another great way to make it easier for your visitor to find and connect with your members.

Filter by Category

To add a category filter to your Directory display, add this parameter to your [business_directory] shortcode: show_category_filter=”yes”

Add filter by category search to Business Directory plugin

NOTE: A-Z search and Filter by Category can both be displayed on the page, but they cannot be used in combination.


Search feature not working

If your search feature is not working, first, check to be sure your setup is correct.

  1. Setup search page using the search form shortcode.
  2. Setup results page using the results shortcode.
  3. Connect the search page to the results page by adding page slug.
    (Scroll to top of page for shortcode details.)

Once you have confirmed that your setup is correct, if you are still not getting the results you expect, go to Settings >> Permalinks. Try setting your permalinks to ‘Post name’ instead of the default one.

How the Search Widget works

  • The Business Category Search pulls up all Businesses listed in the selected category.
  • The Keyword Search searches the Business title and description fields. Your search word must appear in one of these fields in order to be included in the keyword search results.

NOTE: Similar keywords are not included in the search. For example bakeries will not be included in a keyword search for bakery. However, if you use bakeries as a category, all the Businesses in that category will be shown on your search results page.

Setup Search for second language

If you are creating a multi-lingual Business Directory, you will need to setup 2 search features with 2 separate results pages. See translation setup instructions here.

A-Z Search not displaying correctly

If your A-Z search feature is not displaying correctly:

Remove extra spaces – Check to be sure there are no extra spaces in your shortcode. Your code should look like this – [business_directory alpha="yes"] – with no spaces between the brackets and the parameters and only one space between parameters.

Retype double quotes – Delete & retype the double quotes on either side of “yes”. Sometimes when code is copy/pasted hidden characters are inadvertently added. If you delete & retype this should clear up the issue.

Check for theme conflict – Check to see if your theme is causing the issue by temporarily switching to the TwentyNinteen theme.

Was this article helpful to you? Yes 2 No