ubermenu_dp_title

Knowledgebase Docs » UberMenu 3
USEFUL? 1
UberMenu 3

Since UberMenu 3.2.1

The Dynamic Posts title filter allows you to filter the titles of the dynamic post results that appear in the menu.

The filter is run on each item returned by a Dynamic Posts item.

Here’s an example that trims each title to the first 10 characters.

add_filter( 'ubermenu_dp_title' , 'test_umdp_title' , 10 , 3 );
function test_umdp_title( $title , $item_id , $post_id ){
   return substr( $title , 0 , 10 );
}

ubermenu_dp_title

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

$title
This is the existing title for the post. The filter callback should return this.
$item_id
This is the ID of the Dynamic Posts menu item menu item. It can be used to conditionally apply this filter only to a specific set of dynamic posts.
$post_id
This is the ID of the post this item links to.