Custom Taxonomies

In WordPress, a taxonomy is a way of grouping posts together. The names for the different groupings in a taxonomy are called terms. Using our Products custom post type example, a taxonomy could be Size and the terms in that taxonomy, Small, Medium, Large, Extra Large, XXL and 3XL.

Taxonomy settings can be found at the bottom of the custom post type edit screen which is located at ToolsPost Types. Click the down arrow to open an existing taxonomy item, the page icon to duplicate a taxonomy, and the cross icon to delete. Click the Add link to add a new taxonomy.

The following taxonomy fields are available:

Label: The display label.
Slug: Used in the URL.
Hierarchical: If enabled, the taxonomy will behave like categories where a hierarchical/tree structure is possible. If disabled, the taxonomy will behave like tags with no option for a hierarchical/tree structure.

Managing Custom Taxonomies

Once your custom post type has been added you’ll see a new menu item with its name in the main WordPress menu. In our example case, a new menu item called Products is visible in the main WordPress menu. Hover over your new post type, any custom taxonomies created will be visible as a sub-menu item. Click on the custom taxonomy name to manage it. The interface is the same as you would see when managing post categories or tags.

Taxonomy Widget

If you’d like to display taxonomy information on your single post page, insert a SiteOrigin Taxonomy Widget into your custom post type layout. Using our Products example, the Taxonomy Widget would be inserted into the product layout in order to display information like the product category, size of the item, and whatever additional grouping information is required.

The taxonomy includes the following fields:

Title: The display title of the widget. This text will be displayed first.
Taxonomies: Choose from existing WordPress taxonomies like categories or custom taxonomies created when building the custom post type.
Label: The label text that displays to the left of the chosen taxonomy information.
Display as: Choose to display taxonomies as either links or buttons.
Color: In the case of links, this will set the link text color. In the case of buttons, this will set the button background color.
Hover color: In the case of links, this will set the link text hover color. In the case of buttons, this will set the button background hover color.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More