WordPress.org

Ready to get started?Download WordPress

Forums

How can i HIDE the parent page link when ON the parent page? (1 post)

  1. Justin Sternberg
    Member
    Posted 4 years ago #

    i have links in my sidebar, and right now, they contain the current parent page, and the child pages of the current parent page.
    Is there a way i can HIDE the parent page link when ON the parent page, (yet still showing child pages) and then show it again when ON a child page? Have not been able to find the answer anywhere.
    The site is currently at http://fitzfi.com/wordpress/
    my code currently looks like this:

    <?php
    
    $parent_title = get_the_title($post->post_parent);?>
    <a href="<?php echo get_permalink($post->post_parent) ?>"><?php echo $parent_title;?></a>
    
    <ul class="children">
    <?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) {
      ?>
      <ul>
      <?php echo $children; ?>
      </ul>
      <?php } ?>

    or see it here: http://drp.ly/Ue6ab

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 4 years ago by Justin Sternberg
  • This topic is not resolved
  • WordPress version: 2.9.1