WordPress.org

Ready to get started?Download WordPress

Forums

echoing menu navigation label other than navigation bar (5 posts)

  1. rikardo85
    Member
    Posted 2 years ago #

    Hello

    Within the dashboard of wordpress, I am in the menu section and have changed the navigation label of a page.

    This echos out fine on the front end (navigation bar.) What I want to do is print this elsewhere on the site.

    e.g I changed the navigation label to about us. (original page title:Joe bloggs) This echos out to the navigation on the front end as about us (this is fine), However I need to print out the label value (about us) elsewhere on the site e.g. left hand panel sub navigation.

    The code I am currently using below:

    <?php
      if($post->post_parent)
      $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
      else $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
      if ($children) {
    $parent_title = get_the_title($post->post_parent);?>
    <h2 class="lhp_title"><strong><?php echo $parent_title; ?></strong>/h2>
    <ul>
    <li><a>post_parent)?>"><?php echo $parent_title;?></a><?php echo $children; ?></li>
    </ul>
    <?php } ?>

    [Please post code snippets between backticks or use the code button.]

    I want to input the navigation label code instead of the (echo $parent_title;) within h2 tag.

    Hope you can help

    Thanks

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    <h2 class="lhp_title"><strong><?php if is_page('Joe bloggs') ) echo 'about us'; else echo $parent_title; ?></strong>/h2>
  3. rikardo85
    Member
    Posted 2 years ago #

    Thanks for the reply.

    This works but isn't what I am looking for. sorry.

    I have several pages that have been renamed by the menu navigation label.

    Please see link below:

    http://beta.granite5.com/bournschool/bourn-primary-school/

    The navigation label in the top navigation (about us) is fine.
    However the title above the left hand sub navigation list takes the original page name (bourn primary school) This should say about us to.

    Thanks

  4. esmi
    Forum Moderator
    Posted 2 years ago #

  5. rikardo85
    Member
    Posted 2 years ago #

    Thanks but that still does not help.

    I am looking for a function to get the menu navigation label.

Topic Closed

This topic has been closed to new replies.

About this Topic