Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've created a custom menu using pages. For a lot of the list items, I've specified a custom menu title for the page... So, the About Us page becomes About on the menu, for example. Then, when the page title is changed, it's changing the title on the menu as well. So if I change About Us to About Our Company the menu is getting changed from About to About Our Company.

Is there a way to change the default in WordPress, so those custom menu titles are the default instead of the page name?

From header.php:

<?php 
wp_nav_menu( array(
    'theme_location' => 'primary', 
    'sort_column' => 'menu_order', 
    'container_id' => 'nav', 
    'container' => 'div' 
) ); 
?>

From functions.php:

register_nav_menu( 'primary', 'Primary Menu' );
share|improve this question
add comment

2 Answers

Are you in Appearance > Menus? Is that what you mean by custom menu? Can you share the code you are using to make the menu display? I have this in my header:

wp_nav_menu( array('menu' => 'topnav' ));

Where topnav is the name of my custom menu. You have to add the pages to the custom menu in the "Custom Links" area, if you just use the "Pages" and checkboxes, then it will default to the Page title.

Hope this helps!

share|improve this answer
    
yeah, I'm in appearance > menus. Yes, that's what I meant by custom menu. code is above. I need to be able to add pages, without using the "Custom Links" and have it default to the title I set for it. –  Kegan Quimby May 21 '12 at 20:30
    
you could try a custom fields that contains the desired title, then write code to pull that into the menu. But that would be a lot of work, why can't you use "Custom Links"? It would be much easier. –  Donna May 22 '12 at 12:47
    
because the custom links don't add the "current-page-ancestor" as a class to the link. I need that so the current link can be styled. –  Kegan Quimby May 22 '12 at 13:57
    
This may be of help: blago.net/coding/snippets/… –  Donna May 22 '12 at 14:07
add comment

Check that the option to Automatically update Top Level Menu Item's isn't selected in the Nav Menu options screen. If that doesn't do it, maybe your menu's aren't registered correctly. Try re-arranging the top level items and see if it changes on the site. If none of that works,try posting the code used to display your custom menu (the header.php code and the functions.php code that registers the menu).

share|improve this answer
    
none of that worked... posted code above –  Kegan Quimby May 21 '12 at 20:29
    
Your code above works for me. I created a basic theme and added your code above and all worked fine. I was able to change a page title in the wp-nav menu and it changed in the menu, but left the page title as set in the page editor. Maybe you have a plug-in causing issues. Try temporarily disabling your plug-ins and see what happens. –  Jeremy Jared May 21 '12 at 21:45
    
now change the page title tho, and the menu title should change as well –  Kegan Quimby May 21 '12 at 21:59
add comment

Your Answer

 
discard

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.