WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Create a menu with Pages (1 post)

  1. tabouziane
    Member
    Posted 2 years ago #

    I love this but it's only showing one Page. Is there a way to show all the pages/subpages. I think I need a loop or something?

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

Topic Closed

This topic has been closed to new replies.

About this Topic