Support » Alpha/Beta/RC » Display Title Attribute in Menu

  • I’m using the new menu system in WordPress 3.0 and wondering if it’s possible to display the title attribute ($menu_item->attr_title) which you can specify for a page or category within the menu itself. I’m using something like this, but the title will not display unfortunately:

    <?php wp_nav_menu('sort_column=menu_order&container_class=&menu=Header Navigation&link_after=<br />'.$menu_item->attr_title); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • hello, i know it is an old question, but i thought id share my solution. perhaps it’s useful for someone else.

    add this to your functions.php

    add_filter('walker_nav_menu_start_el', 'description_in_nav_el', 10, 4);
    function description_in_nav_el($item_output, $item, $depth, $args)
    	return preg_replace('/(<a.*?>[^<]*?)</', '$1' . "<em>{$item->attr_title}</em><", $item_output);

    Thanks youtag. This was indeed helpful.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display Title Attribute in Menu’ is closed to new replies.