Different page name for menu
How do I use a different page name/title for the menu bar?
I need to put ‘About’ in the mneu bar (horizontal) for economy’s sake, but the full page title I want to be ‘About Glass Bottle Makers’.
That’s too long for the menu bar. How do I differentiate but obviously keep the same (linking) relationship?
The only solution I can think of is to create a custom field called ‘longtitle’ and put your long title in there. Then, retrieve that field during the loop, and use its value in place of the_title tag.
<?php while (have_posts()) : the_post(); $postmeta = get_post_custom($post->ID); ?> <h2><?php echo $postmeta['longtitle']; ?></h2> rest of loop code here ... <?php endwhile; ?>
Actually, there is another way. You could use this plugin. Create a dummy page with the short title for your menu, and redirect it to the real page with the long title.
The only problem with that is you would have to find a way to exclude the “real” page from your menu.
Should add if else statement there, if that custom meta don’t exist return to
Should add if else statement there, if that custom meta don’t exist return to the_title()
Yes, true. I didn’t intend that as production-ready code, I was just outlining the general idea.
I found a plugin for this:
It basically just automates what I was describing about a ‘longtitle’ custom field.
Ambrosite and Zeo, thanks for your replies. I’m not a coder…which file is that code example from?
Might be easier for me to use that plugin 😉
If you’re not a coder, I recommend using the plugin (Page Menu Editor). The code sample I gave is incomplete, and the plugin works quite well.
- The topic ‘Different page name for menu’ is closed to new replies.