WordPress.org

Ready to get started?Download WordPress

Forums

List of sub pages on parent page (2 posts)

  1. Anatis
    Member
    Posted 3 years ago #

    On my old blog, I used to use Flexi Pages widget, but I'm trying to get away from that.
    I'm now using a modified twentyten theme (my own), but the loop-page.php and the page.php have defeated me so far.

    What I would like to do is the following:

    On the parent page, I want to show a bulleted list of its sub pages.

    No matter how I edit things, it doesn't seem to work. I tried to include it on the page.php, but it lists the child pages either above the actual page, or below (before the comments), but not inside the content.
    If I add it to the loop-page.php, it seems to do nothing at all.
    I'm sorry, my php coding really sucks.
    On top of it, the live blog just went down, so I can't get at the code I did use. (Argh!!)
    Will post it when I can, but if anyone knows a way, I'd much appreciate it.
    Ideally I don't want to edit the page.php, but use the loop-page.php instead.

  2. Anatis
    Member
    Posted 3 years ago #

    I've figured it out. :)
    If you insert the following in your loop-page.php

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

    before edit_post_link -- you get a nice bulleted list of the subpages of that particular page, without ever having to touch the page.php

    I hope this helps someone else. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags