WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a way to include a user managable title in a menu. Ideally, it will take the place of the first <li> object in the output.

Any ideas?

Edit Clarification

I am looking for a way to add a header to a menu list, defined by the given name of the menu in the admin panel.

So, the code should look a little like this:

  <li class="title"> Menu Name</li>
  <li><a href=#>Link</a></li>
  <li><a href=#>Link</a></li>
  <li><a href=#>Link</a></li>
  <li><a href=#>Link</a></li>

Edit Further Development

I have a code block for extracting the name of a menu, based on it's location in a theme, but I can't quite get the HTML layout I want (i.e. add the title to the first <li>).

function mf_get_menu_name($location){
    if(!has_nav_menu($location)) return false;
    $menus = get_nav_menu_locations();
    $menu_title = wp_get_nav_menu_object($menus[$location])->name;
    return $menu_title;
share|improve this question
care to explain a bit more? – Bainternet Jul 19 '11 at 11:01
Added clarification and details of where I am with the problem. – Mild Fuzz Jul 19 '11 at 15:39

Are you looking to put a title on the nav links? That is built into the Menu feature in Wordpress.

Wordpress Title Menu

But this applies to the tag and not the <li> as you specified. You can, however, apply a class to the <li> by clicking the "Screen Options" link while in the Menu Admin page. Then, find the "CSS Class" checkbox under "Show advanced menu properties".

Finally, you could give your links the desired title and then apply the following jQuery to apply the title to the <li> and remove it from the <a>.

$(function() {

    $('ul li').each(function() {

        var linkTitle = $(this).find('a').attr('title'); //get the link title
        $(this).attr('title', linkTitle); //apply the title to the li



JSFiddle example: http://jsfiddle.net/tmort/E5VzC/3/

share|improve this answer
Sorry, not really what I meant, I have explained further in the question. – Mild Fuzz Jul 19 '11 at 19:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.