Search Form Shortcode
Activate search bar for Business Directory
Step 1: Create a search page
Display a business directory search form on your Chamber website, by creating a page and inserting the following shortcode:
The page with the
[business_search_form] shortcode will display the 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:
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”, using the slug of your search results page, to your
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
Pro Tip: 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.
Search Results Page
By default, the search results page will display as a single column. You can use grid2 or grid3 to create a multi-column display. For example
[business_search_results format="grid2"] will display search results in 2 columns.
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 listing 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 Chamber Dashboard settings.
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
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”
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.
- Setup search page using the search form shortcode.
- Setup results page using the results shortcode.
- 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.