WordPress.org

Forums

Different page name for menu (9 posts)

  1. hj
    Member
    Posted 5 years ago #

    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?

    HJ

  2. ambrosite
    Member
    Posted 5 years ago #

    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'][0]; ?></h2>
    
        rest of loop code here ...
    
    <?php endwhile; ?>
  3. ambrosite
    Member
    Posted 5 years ago #

    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.

    http://txfx.net/wordpress-plugins/page-links-to/

    The only problem with that is you would have to find a way to exclude the "real" page from your menu.

  4. Safirul Alredha
    Member
    Posted 5 years ago #

    Should add if else statement there, if that custom meta don't exist return to the_title()

  5. ambrosite
    Member
    Posted 5 years ago #

    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.

  6. ambrosite
    Member
    Posted 5 years ago #

    I found a plugin for this:

    http://www.stuffbysarah.net/wordpress-plugins/page-menu-editor/

    It basically just automates what I was describing about a 'longtitle' custom field.

  7. hj
    Member
    Posted 5 years ago #

    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 ;)

  8. ambrosite
    Member
    Posted 5 years ago #

    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.

  9. hj
    Member
    Posted 5 years ago #

    Thanks, I installed it....just the ticket!

    cheers

Topic Closed

This topic has been closed to new replies.

About this Topic