WordPress.org

Support

Support » How-To and Troubleshooting » Displaying child pages of parent pages problem

Displaying child pages of parent pages problem

  • So I read the part on displaying child pages that are associated with parent pages here: http://codex.wordpress.org/Template_Tags/wp_list_pages

    and here is the code I’m using in my sidebar, but nothing shows up. Am I doing something wrong?

    <?php if (is_page(‘mac’))
    {
    echo “<div class=’sidebar’>”;
    echo “<h2>Mac Articles</h2>

      “;
      print wp_list_pages(“title_li=&child_of=”.$post->ID.”&sort_column=menu_order&show_date=modified&date_format=$date_format”);
      echo “

    </div><!– sidebar –>”;
    } ?>

    All I want to be able to do is display the child pages of 1 specific parent page in the sidebar. Thanks for any and all help!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Then you don’t need that complicated thing :0
    Just to make sure I understood correctly your request. You always want to display the same list of children/subpages of a certain X parent page?
    If yes, just read carefully the parameters:
    http://codex.wordpress.org/Template_Tags/wp_list_pages

    For example, I have a page I titled Mac. I want to use that parent page to house a bunch of child pages that will be tips and tricks. I would like to have any current and new child pages created under the Mac parent page to appear in the sidebar. I do want to be able to do this with a few other pages, but not ALL the parent pages.

    So, the child_of=342 doesn’t work? (provided page_id=342 is your Mac Page)

    Hrmmm, if I put wp_list_pages(“title_li=&child_of=63″.$post->ID.”&sort_column=menu_order&show_date=modified&date_format=$date_format”);

    It just displays my forum and profile which aren’t even in the pages list.

    I just tried doing this:

    print wp_list_pages(“child_of=’63’&echo=0”); and that still did the same thing.

    If I just do a:

    print wp_list_pages(“mac”); all my pages display.

    <?php wp_list_pages('child_of=63'); ?>
    That’s all. And notice the single quotes.

    Hrmmm…that worked. Although it still does display the Forums and Profile which aren’t pages as far as I can tell from the admin panel.

    http://www.bui4ever.com/mac, all the way in the sidebar to the bottom.

    Have you looked at the Fold page list plugin?

    You also might want to play with the exclude string of these functions.

    moody, that didn’t work.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Displaying child pages of parent pages problem’ is closed to new replies.
Skip to toolbar