Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Using the WP menu Title Attribute in a theme. WordPress


What I want to do is use the Title Attribute (from links in the menu manager) value in my theme, if possible. For example, I have a menu where there will be links like About, and then below that I want to have "Who we are" or something similar. The only thing I could think of is using the Title Attribute, but couldn't find any info about echoing that in a theme.

I have attached the look of my menu, the Title Attribute I'm referring to, and my menu code.

<?php wp_nav_menu( array('menu' => 'Header', 'menu_id' => 'nav' )); ?>

Thanks guys!

Answers (3)


Maor Barazany answers:

You can use this tutorial that explains how to view the menus' description .

If you have questions of implementing it, you may ask.

[[LINK href=""]][[/LINK]]


Oleg Butuzov answers:

add_filter('walker_nav_menu_start_el', 'el_filter');
function el_filter($string, $item){
return $string.'<h1>'.$item->attr_title.'</h1>';


Adan Archila answers:

I had that problem before, and my solution was using a custom field called "Description"
Here is the code I used.


$pages =get_pages('sort_column=menu_order&exclude=199,65,160,111,177,72,9,60,57&meta_key=Description');

foreach($pages as $page) :
global $wp_query;
$thePostID = $wp_query->post->ID;

if ( $thePostID == $page->ID ) $nav_class = "current_page_item"; else $nav_class = ""; ?>
<li class="<?=$nav_class?>">
<a href="<?php echo get_page_link($page->ID); ?>"><?php echo $page->post_title; ?></a>
<p class="nav_description"><? echo get_post_meta($page->ID, 'Description', true); ?></p>