Overview
A Dynamic Terms menu item will add a group of terms to your menu based on the query settings that you configure.
Terms are items in a taxonomy. Terms are used to organize your content (posts, pages, custom post types) into different groups. By default, your WordPress install has two taxonomies: Categories and Terms, but you can also use Custom Taxonomies. For example, WooCommerce Product Categories are a type of term.
Related Video Tutorial: Recreating the Demo’s Dynamic Submenu with Dynamic Posts and Dynamic Terms
Adding a Dynamic Terms Item
To add a Dynamic Terms item, go to Appearance > Menus and open the UberMenu Advanced Items section at the bottom of the left column. Check the Dynamic Terms item and click the Add to Menu button.
Add the item to a submenu (as a child item of another item in the menu – dynamic items cannot be in the top level of the menu). When the menu loads, the Term results will be loaded as menu items in this position in the menu hierarchy.
Dynamic Terms Items can only be used in submenus
Configuring the Terms Parameters
The Dynamic Terms item works by running a Terms Query on your database based on the parameters you give it. It uses the core WordPress query functionality.
To configure the parameters, click the Uber button on the Dynamic Terms menu item. The first tab on the left, Dynamic Terms, offers the parameter configuration settings.
Taxonomy
The Taxonomy setting determines which taxonomy to return terms from. For example, if you want to display Categories, you would check only the “Categories” item. You can check multiple taxonomies. Any Custom Taxonomies will also appear here.
Number
The number setting places a limit on the number of results. For example, if you have 20 category items that match your parameters and you set this to 5, only 5 Categories will be displayed. Leave this blank to display all matching terms.
Parent Term
If you would like to display terms that are children of a specific item, you can use the Parent Term parameter. Only items which are direct children of the selected Parent Term will be displayed.
The selection box is a hybrid selection box. The critical value is the number that appears on the right – this is the term ID.
If you click the down arrow, you will see a list of available terms
Please note that this list is limited to 100 terms by default, as a sanity check (if you have thousands of terms to load, this could crash your site attempting to load them all at once). If you want to increase this limit, you can do so in the UberMenu Control Panel > General Settings > Advanced Menu Items > Maximum Autocomplete Term Results. However, you do not need to have the suggested term present to set an item – just enter the term ID in the ID box on the right.
You can scroll through the term options and click a term to select it.
You can also type to filter the results quickly.
Click an item to make your selection and the ID field will be filled in appropriately.
If you would like to use the parent item’s terms in the menu hierarchy rather than setting it explicitly, you can select the option that says Inherit Parent {Taxonomy} Item – or set the ID to -1
. This is useful if your parent menu item is a normal Term Menu Item, or if your parent menu item is another Dynamic Terms item, as this Dynamic Terms Item will inherit the term ID as its parent for each result.
Note: the parent menu item’s term must be compatible with the selected Dynamic Terms arguments for this to work. (e.g. If your Dynamic Terms item is displaying Categories, then the parent item must be a Category item).
To clear your selection, click the icon to the right of the selection box.
Ancestor Term
The ancestor term works just like the parent term. The difference is that an ancestor search will include parent items, grandparent items, and beyond; while parent terms must have a direct descendent relationship with the term.
In other words:
- Animal
- - Dog
- - - Black Lab
- - - German Shepherd
- - Cat
- - - Siamese
Animal is an ancestor of Black Lab. Dog is a parent of Black Lab (Dog is also an ancestor).
Setting Animal as a parent term will return only the terms Dog and Cat.
Setting Animal as an ancestor term will return all terms below it in the taxonomy hierarchy – Dog, Black Lab, German Shepherd, Cat, Siamese.
Sort by
The Sort By setting determines the attribute of the term that will be used to sort them. Term Name is generally what you want for an alphabetical list.
Sort
The Sort setting determines the sort order (normal or reverse).
Ascending = 1-10, A-Z
Descending = 10-1, Z-A
Hide Empty
When enabled, the Hide Empty option will ignore any terms that do not have any associated posts.
Hierarchical
Display terms that have non-empty descendants (even if Hide Empty is enabled). This means that if there are no posts for the term “Dog”, but there is a post for the term “Black Lab” and “Black Lab” is a descendant of “Dog”, then the term “Dog” will still be displayed.
Ignore Empty Results
If your query produces zero results, you’ll see a notice that says “[Dynamic Terms]: No Results Found”. It includes the taxonomy query arguments so that you can troubleshoot the query. This notice is only displayed to admins, it won’t be shown to normal site visitors. If you want to disable the notice even for admins, you can enable the “Ignore Empty Results” setting
Automatic Columns
If you would like your results set to be displayed in multiple columns, ordered top to bottom then left to right, you can set the Automatic Columns setting. This will count your results and divide theme evenly over your chosen number of columns. You may need to set the Columns Width setting in the Layout tab (normally to Full Width).
Display Term Counts
If you would like to display the number of associated posts for each term after the term name, you can enable this setting.
General, Icon, Layout, and Responsive Tabs
The settings within each of these tabs will apply to each term in the results. The settings for each result cannot be controlled individually – unless you add them individually to the menu rather than using a Dynamic Terms item.
Multiple Dynamic Levels
Dynamic Terms items can be nested to create multiple levels of a term hierarchy. See Nesting Dynamic Terms.