1. Home
  2. Docs
  3. Shortcodes
  4. Shortcodes
  5. Single Tag

Single Tag

You can display all listings of a single tag using the following shortcode. Remember, if you visit the page after adding this [directorist_tag] shortcode directly, you will see something like this ‘No Results Found.’ message. It is because the Directorist plugin will use the page with this shortcode to display all listings of a specific tag dynamically when a user clicks on a single tag anywhere on your website. In other words, this page is not for direct access so it is better not to include the page with this shortcode in the nav menu.

Single Tag Shortcode: [directorist_tag]

The [directorist_tag] shortcode has a number of parameters to customize the output. Let’s have a look at the available attributes/parameters and their available values with some description.

Attributes/Parameters:

  1. view: You can display all listings of a tag in a list layout or grid layout. Available Options: list and view. The default value is grid. Example: [directorist_tag view=”grid”]
  2. orderby : You can order all listings of a tag using this parameter. Options available : title, date & price. The default is date. Example: [directorist_tag orderby=”date”].
  3. order: You can sort all listings of a tag in ascending or descending order. Options available: asc | desc. The default is asc. Example: [directorist_tag order=”asc”].
  4. listings_per_page: You can set the number of listing to show per page using this parameter. The default is 6. Example: [directorist_tag listings_per_page=”6″].
  5. logged_in_user_only: You can make single tag only visible for logged in user using this parameter. Options available: yes | no. Example: [directorist_tag logged_in_user_only=”no”].
  6. redirect_page_url: Forward/redirect single tag page using this parameter. Example: [directorist_tag redirect_page_url=”www.aazztech.com”].
  7. header: You can show/hide header area using this attributes. Options available: yes | no. Example: [directorist_tag header=”yes”]
  8. header_title: You can customize header title using this parameter. For example [directorist_tag header_title=”All items under this tag”]
  9. header_sub_title: You can customize header sub title using this parameter. For example [directorist_tag header_sub_title=”Total Listing Found: “]
  10. columns: You can set the number of columns of the grid view layout using this attribute. Example [directorist_tag columns=”3″]
  11. show_pagination: You can show/hide pagination. Available options: yes|no. Example [directorist_tag show_pagination=”yes”]

 

 

Bonus tips: Suppose your single tag page url is like this (https://yourwebsite.com/single-tag-page-url) and you have two tags BMW and Nissan. Then you can display/view all listings under bmw tag by visiting https://yourwebsite.com/single-tag-page-url/bmw and view all listings/cars by Nissan by visiting https://yourwebsite.com/single-tag-page-url/nissan. Now you may have noticed how this single tag page works dynamically. So basically it works like this. https://yourwebsite.com/single-tag-page-url/{tag_name}

 

NB: You may be wandering if there is a shortcode to display all directorist tags. The truth is there is no shortcode for displaying all tags. It is because people usually do not need it. However, you can display all tags using directorist tags widget which can be found the WordPress Dashboard > Appearance > Widgets page.