Shortcodes

Introduction

BD Shortcodes are how you can easily place directory functionality on certain pages within your site. Just drop a shortcode in a page with the parameters it requires and boom, you have the functionality you need!

They are a fundamental way for WordPress to allow plugin-specific functionality to appear within your posts and pages.

New to shortcodes? It’s important that you read and understand this article here: https://www.smashingmagazine.com/2012/05/wordpress-shortcodes-complete-guide/

And here: https://codex.wordpress.org/Shortcode.

They will help you with the basics of shortcodes in WordPress.

Supported Shortcodes

[businessdirectory-region]

Used For:
Displaying a set of listings from a given region.
Other valid names:
[business-directory-region] [wpbdp-region]
Parameters:
Name Description Allowed Values
region Required The region for the listings. A valid Region name already configured under Directory Admin->Manage Regions
children Whether to include listings from children regions or not. Defaults to 1. 0 or 1
Examples:
- Display all listings in the USA (including its states, cities, etc.):

[businessdirectory-region region="USA" children=1]

[businessdirectory-regions-browser]

Used For:
Shows the "Regions browser", similar to what Craigslist shows on the home page when first visiting the site to pick your preferred location.
Other valid names:
[wpbdp_regions_browser]
Parameters:
Name Description Allowed Values
base_region Required What region to use as the "starting point" for the browser. Usually the parent region of some regions you want displayed. If not supplied, it will use your top-most region as the starting point. A valid Region name already configured under Directory Admin->Manage Regions
breadcrumbs Whether to display the breadcrumbs while navigating children regions or not. Defaults to 1. 0 or 1
Examples:
[businessdirectory-regions-browser base_region="Asia"]

[businessdirectory-region-home]

Used For:
Shows the main directory page but filtered automatically with the given region.
Other valid names:
[business-directory-region-home]
Parameters:
Name Description Allowed Values
region What region to use as the "starting point" for the directory filter. A valid Region name already configured under Directory Admin->Manage Regions
selector Whether to display the Region selector or not. Defaults to 0. 0 or 1
Examples:
[businessdirectory-region-home region="USA"]

[businessdirectory-map]

Used For:
Shows the Map with markers for listings on it.
Other valid names:
[business-directory-map]
Parameters:
Name Description Allowed Values
category What category to use for filtering. A valid Region name already configured under Directory Admin -> Manage Regions
region What category to use for filtering. A valid Region name already configured under Directory Admin -> Manage Regions
Examples:
- Display a map of restaurants in New York:

[businessdirectory-map region="New York" category="Restaurants"]

[businessdirectory]

Used For:
Displaying the main directory page and all directory content.
Other valid names:
[business-directory] [WPBUSDIRMANUI]
Parameters:
None.
Notes:
Required. Installed by BD automatically. Cannot be removed from site unless you plan to uninstall BD.
Examples:
[businessdirectory]

[businessdirectory-submit-listing]

Used For:
Creating a separate "Submit Listing" page for BD.
Other valid names:
[WPBUSDIRMANADDLISTING]
Parameters:
None.
Notes:
Optional. Not needed if you are just using the standard directory links and buttons. This allows you to have a separate page if you want to have some special content around the page.
Examples:
[businessdirectory-submitlisting]

[businessdirectory-manage-listings]

Used For:
Bulk listing editor page for users to see and manage their listings when logged in.
Other valid names:
[business-directory-managelistings] [WPBUSDIRMANMANAGELISTING]
Parameters:
Name Description Allowed Values
showsearchbar Allows you to control the visibility of the search bar at the top of the page. Default is 1 if not specified. 0 or 1.
Examples:
[businessdirectory-manage-listings]

[businessdirectory-listings]

Used For:
Showing listings with a certain type, tag or filter.
Other valid names:
[businessdirectory-viewlistings] [WPBUSDIRMANVIEWLISTINGS] [WPBUSDIRMANMVIEWLISTINGS]
Parameters:
Name Description Allowed Values
tag Shows the listings with a certain tag name. Any valid tag name within the directory. Can be a comma separated list too (eg. "New, Hot").
category Shows the listings with a certain category. Any valid category name or ID you have configured under Directory -> Directory Categories. Can be a comma separated list too (e.g. "Dentists, Doctors" or 1,2,56).
title Adds a title to the page of listings to indicate what they are for. Any non-blank string.
Notes:
Good for displaying listings in a single category or from a single tag.
Examples:
- Display listings from category "Dentists" with tag "New" and include a title.

[businessdirectory-listings tag="New" category="Dentists" title="Recent Listings for Dentists"]

[businessdirectory-featuredlistings]

Used For:
To show all of the featured listings within your directory on a single page.
Parameters:
Name Description Allowed Values
number_of_listings Maximum number of listings to display. Any positive integer or 0 for no limit
Examples:
[businessdirectory-featuredlistings]

[businessdirectory-listing]

Used For:
Displaying a single listing from the directory (by slug or ID).
Parameters:
Name Description Allowed Values
id Post ID of the listing. Any valid listing ID.
slug Slug for the listing. Any valid listing slug.
Notes:
At least one of the parameters id or slug must be provided.
BD Version Required:
3.6.10 or higher
Examples:
[businessdirectory-listing slug="my-listing"]

[businessdirectory-categories]

Used For:
Displaying the list of categories in a similar fashion as the main page.
Parameters:
Name Description Allowed Values
parent Parent directory category ID. A directory category term ID
orderby What value to use for odering the categories. Default is taken from current BD settings. "name", "slug", "id", "description", "count" (listing count).
order Whether to order in ascending or descending order. Default is taken from current BD settings. "ASC" or "DESC"
show_count Whether to display the listing count next to each category or not. Default is taken from current BD settings. 0 or 1
hide_empty Whether to hide empty categories or not. Default is 0. 0 or 1
parent_only Whether to only display direct childs of parent category or make a recursive list. Default is 0. 0 or 1
no_items_msg Message to display when there are no categories found. Any non-blank string
Examples:
- Display the list of categories starting at the one with ID 20 and ordering by slug.
[businessdirectory-categories parent=20 order="slug"]

[businessdirectory-listing-count]

Used For:
Outputs the listing count for a given category or region.
Parameters:
Name Description Allowed Values
category What category to use. A valid category ID, name or slug.
region What region to use. A valid region ID, name or slug.
Notes:
If both parameters are provided the result is the number of listings inside the given category located in the given region.
Examples:
- To count how many listings you have in the "Restaurants" category that are located in "New York"

[businessdirectory-listing-count category="Restaurants" region="New York"]

[businessdirectory-latest-listings]

Used For:
Displaying the latest listings.
Parameters:
Name Description Allowed Values
limit The number of listings to show. Defaults to 10. A positive integer
menu Whether to include the quick search and menu bar as part of the output. Defaults to 0. 0 or 1
buttons Which menu buttons to show inside the menu (applies only when menu is 1). Default is none. "all", "none", or a comma-separated list from the set "create", "directory" and "listings"
BD Version Required:
4.1.13 or higher
Examples:
- Display the latest 5 listings submitted to the directory:
[businessdirectory-latest-listings limit=5]

[businessdirectory-random-listings]

Used For:
Displaying a set of random listings from the directory.
Parameters:
Name Description Allowed Values
limit The number of listings to show. Defaults to 10. A positive integer
menu Whether to include the quick search and menu bar as part of the output. Defaults to 0. 0 or 1
buttons Which menu buttons to show inside the menu (applies only when menu is 1). Default is none. "all", "none", or a comma-separated list from the set "create", "directory" and "listings"
BD Version Required:
4.1.13 or higher
Examples:
- Display a set of 10 random listings, including the directory menu with only the "Create A Listing" button:

[businessdirectory-random-listings menu=1 buttons="create"]