The Dynamic Post subcontent filter allows you to set custom content based on a specific dynamic post

This filter is run for a specific Dynamic Posts item when the Dynamic Subcontent setting is set to Custom

Here’s an example that prints the post date for each dynamic post (note that this is already available as a built-in option, used here simply for illustration)

function my_uber_add_subcontent( $content , $post , $item_id ){

   $content.= '<span class="ubermenu-target-description ubermenu-target-text">';
   $content.= mysql2date( get_option( 'date_format' ), $post->post_date );
   $content.= '</span>';

   return $content;
add_filter( 'ubermenu_dp_subcontent' , 'my_uber_add_subcontent' , 10 , 3 );

The ubermenu-target-description ubermenu-target-text classes style the result like an UberMenu Description, but you can add whatever markup you like and style it yourself.


Your registered callback will be called once for each post generated by a dynamic post item. The content that you return will be displayed in that post item in the menu. You have access to the current post object and the menu item’s ID to generate your content.

This is the content to be displayed below the post title. The filter callback should return this.
This is the post object for each returned post.
This is the ID of the Dynamic Posts menu item. It can be used to conditionally apply this filter only to a specific set of dynamic posts.

On this page