Dynamic Posts

Knowledgebase Docs » UberMenu 3
USEFUL? 39
UberMenu 3

A Dynamic Posts menu item will add a group of post items to your menu based on the query settings that you configure.

“Posts” are any public post type on your site. They represent discrete pieces of content on your site. By default your WordPress install has two public post types: Posts and Pages, but you can also use Custom Post Types. For example, WooCommerce Products are a type of post.

Related Video Tutorial: Recreating the Demo’s Dynamic Submenu with Dynamic Posts and Dynamic Terms

Adding a Dynamic Posts Item

To add a Dynamic Posts item, go to Appearance > Menus and open the UberMenu Advanced Items section at the bottom of the left column. Check the Dynamic Posts 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 Post results will be loaded as menu items in this position in the menu hierarchy.

Dynamic Posts Items can only be used in submenus

Configuring the Post Query Parameters

The Dynamic Posts item works by running a search query for posts in 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 Posts menu item. The first tab on the left, Dynamic Posts, offers the parameter configuration settings.

Limit

The limit setting places a limit on the number of results. For example, if you have 20 posts that match your parameters and you set this to 5, only 5 Posts will be displayed. Set to -1 to display all matching posts.

Post Type

The Post Type setting determines which post types to return posts from. For example, if you want to display Pages, you would check only the “Pages” item. You can check multiple post types. Any Custom Post Types will also appear here.

Category

If you would like to display posts that are in a specific Category, you can use the Category parameter.

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 Categories

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 Category/term options and click a term to select it.

You can also type to filter the results quickly.

Click and 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 a Dynamic Terms item, as this Dynamic Posts Item will inherit the term ID as its parent for each result.

To clear your selection, click the icon to the right of the selection box.

Tags

Tags work exactly the same as Categories. Note that if you use multiple taxonomy parameters, the results must meet all of the settings (AND not OR).

Custom Taxonomies

A special selection box for each Custom Taxonomy will also appear here. It functions just the same as the Categories selection.

Parent Post

This item is specific to post types that are hierarchical (e.g. Pages but not Posts).

If you would like to display posts that are children of a specific item, you can use the Parent Post parameter.

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 posts

Please note that this list is limited to 100 posts by default, as a sanity check (if you have thousands of posts 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 Post Results. However, you do not need to have the suggested post present to set an item – just enter the post ID in the ID box on the right.

You can type a post name to filter just like with the term selection boxes. Click your desired post to set that as your Parent Post.

Post Author

Filter your results by post author. You can select multiple authors.

Sort by

The Sort By setting determines the attribute of the term that will be used to sort them. “Post Title” is generally what you want for an alphabetical list. “Publish Date” is useful for a list of recent posts.

Sort

The Sort setting determines the sort order (normal or reverse).

Ascending = 1-10, A-Z

Descending = 10-1, Z-A

Automatic Columns

If you would like your results set to be displayed in multiple columns, 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).

Automatic Columns will organize your results top to bottom, then left to right.

147
258
369

If you want them organized left to right, then top to bottom, leave this setting disabled and use the Columns Width setting instead.

123
456
789

Dynamic Subcontent

(Since version 3.1.1)

The Dynamic Subcontent setting allows you to add content below your post title, including Date, Author, and Excerpt.

You can also add your own dynamic subcontent using the ubermenu_dp_subcontent filter.

General, Icon, Layout, Submenu, Customize Style, and Responsive Tabs

The settings within each of these tabs will apply to each post 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 Posts item.

Image

If you would like to display the post’s featured image along with each result, select Dynamically Inherit in Image > Inherit Featured Image

You can also control the image size in the settings, as well as the layout.