Support » Themes and Templates » listing only sub-pages in sidebar

  • I have extensively read the forums, and perhaps my weak knowledge of php and CSS is keeping me from seeing the answer the I need. Or I’ve justbeen staring at it too long.

    I have three parent Pages. Each has many subpages. I would like the sidebar to have sections, with headers, that list only the child pages.

    The site is here:

    In the left sidebar there is currently a header, “industry,” and below it the link to the parent page, also called “industry.” On the right there is a similar set up with “reviews” and “fiction.”

    Ideally I would like ONLY the child pages to “industry” appear under that heading. Under “reviews” and “fiction” I would like only the four most recent child pages to appear. I assume this can be done with the wp_list_pages code but I can’t figure out how to order the parameters, or maybe even use the right ones. I’ve re-read the documentation on it about 6 times now, and clearly I’m missing the answer, though I am sure it’s there.

    Additionally, is it possible to put code on a parent page, not in the sidebar, but as the body of the page, that would just call a list of all the child pages of said parent?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Is there some trick to getting responses on this forum? Are there other places besides here and in the Codex that I can look for help?

    try this widget in your side bar …. it works great.

    It looks great, but unfortunately it doesn’t do what I need. Partly because my sidebars aren’t widget ready, they are basically “hard coded” and partly because it displays the subpages only when you are on the parent page. I need just the subpages displayed on all the pages, all the time, no matter where you are in the site.

    I think I understand what you are trying to do.

    Since you know that you will only have three ‘parent pages’, then the simplest way to achieve your sub menus is to use the function like this:

    wp_list_pages('title_li=<h2>'.__('ParentPageName') . '</h2>&child_of=ParentPageID
    '); ?>

    Note: You will have to modify this code for each menu that you plan to create. And be sure to replace ‘ParentPageID’ with the ID of each parent page, as well as ‘ParentPageName’ with the name that you’d like to display for each menu header.

    Thanks, VelvetBlues, that works! Hooray! But is there a way to limit how many of the childpages appear? Like only the three most recent?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘listing only sub-pages in sidebar’ is closed to new replies.