WordPress.org

Ready to get started?Download WordPress

Forums

Don't Display Child Page List on Certain Pages (2 posts)

  1. michaelphill
    Member
    Posted 4 years ago #

    I'm using this code to display a bullet list of child pages on my page template.

    <?php
      $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
      if ($children) { ?>
      <ul>
      <?php echo $children; ?>
      </ul>
    <?php } ?>

    However, there are some pages I'd like to not to have the list displayed. What's the best code to do this?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

    <?php
    if(!is_page('About') && !is_page("Foo') ) :
      $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
      if ($children) { ?>
      <ul>
      <?php echo $children; ?>
      </ul>
    <?php }
    endif;?>

    http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.