Go to

Categories overview

Displaying Categories [adverts_categories]

This shortcode is deprecated since WPAdverts version 2.0

Instead, we recommend using blocks – a modern visually customizable alternative to shortcodes.

You can replace this shortcode with the Classifieds / Categories block.

Displays list of Advert Categories in a grid. The categories can be displayed in two modes. Either just the most top categories or categories and sub categories underneath.

Below you can see two screenshots explaining how the categories will be displayed in each mode.

Top categories only.

Adverts Categories Shortcode Displaying Top categories Only (show=”top”)

Adverts Categories Shortcode Displaying All Categories (show=all)

Adverts Categories Shortcode Displaying All Categories (show=all)

 

Shortcode Parameters

  • name: string (default “default”) – this is mainly for future use, the name basically should identify shortcode.
  • columns: int (default 2) – number of columns on the list, it’s best to use either 2 or 3.
  • show: string (default “top”) – allowed values “top”: will display grid of top level categories; “all” will display categories with sub-categories
  • default_icon: string (default “adverts-icon-folder”) – the icon that will be displayed by default if category does not have icon set
  • show_count: boolean (default: true) – show number of items inside each category
  • sub_count: int (default 5) – number of sub categories to display below parent category (applicable only is show=all)

Example Usage

Display top categories in 4 columns and do not display ads count

[adverts_categories show="top" columns="4" show_count="0"]

Display all categories in 4 columns, display max. 10 sub categories for each top category

[adverts_categories show="all" columns="4" sub_count="10"]

Was this article helpful?