ubermenu_dp_subcontent

Knowledgebase Docs » UberMenu 3
USEFUL? 11
UberMenu 3

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.

ubermenu_dp_subcontent

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.

$content
This is the content to be displayed below the post title. The filter callback should return this.
$post
This is the post object for each returned post.
$item_id
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.