Sub-Categories

The Sub-Categories shortcode for WordPress can be used to list child categories of a set ID category or of the current category if no ID is set. Check below for example implementations and shortcode documentation:

Sub-Categories Examples

Sub-Categories Shortcodes

Shortcode
[x3m-subcategory categoryid="1" maxentries="10" column="2"]
The shortcode can be used to list child categories / sub-categories of a set category ID or of current category. Only first-level child categories will be included in the list. The list can be limited to a number of entries and display can be set in columns. Above example lists the sub-categories of our “WP Plugins” category.

Sub-Categories Documentation

Here are the shortcode option settings available for Sub-Categories:

Shortcode Settings Details
categoryid=”1″

optional

This is used to set the category ID for which category the child categories will be listed.

If no categoryid is set, it will pull sub-categories of the current category (where the shortcode is published: category description or post).

maxentries=”10″

optional

This is used to set the maximum number of sub-categories to be included in the list. Categories are ordered alphabetically.

If no maxentries is set, it will display all sub-categories of the category.

columns=”2″ This is used to set the number of columns used to display the list.

Values accepted are “1”, “2” or “3”. For high number of sub-categories to be listed, it is advisable to display them in columns.

pagination=”yes”

optional

This is used to add a pagination to the displayed list. If the list contains more items than the number of columns * max entries, then it will include a pagination at the bottom of the list.

Value accepted is “yes”.

The Sub-Categories shortcode can be implemented in any content inside WordPress. However, for it to display a list of sub-categories, it would be required to set the categoryid parameter. The categoryid parameter is not required if the shortcode is implemented in a post or inside a category description, pulling its current sub-categories. Implementation in any other content type (ex Page) without a categoryid parameter will return an error message.