The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other wp_list_pages struggles Re: wp_list_pages struggles


Getting closer but not quite there yet.

Here is what I have now in my child functions.php – I use Thematic

// Add training articles menu list
function training_articles_menu() {
global $post;
if (is_page('training-articles') || ($post->post_parent=="205")) { ?>

$children = wp_list_pages('depth=1&title_li=&child_of='.$post->ID.'&echo=0');
if ($children) { ?>

    Training Articles by Chris Krowchuk


This displays the list of the child pages when on the parent and it displays a list of child pages when on a child pages (if there are any).

The only thing I am missing that I would like is the list of pages that are grandchildren when on a grandchild page, if they exist.

Does that make sense? It confuses the heck out of me!

So, I have a Parent page, and under that page I have child pages. Some of these child pages also have children, some do not.

I can get a list of child pages when on the parent no problem.
I can get a list of grandchild pages when I am on a child page that has children
I can’t get a list of grandchild pages when I am on a grandchild page in the same hierarchy. This is what I would like to add somehow?

Right now I have the grandchild list hard-coded into the grandchild pages and that is fine, but I would like it dynamic obviously.

Example: is the main parent page

Any wp_list_pages() experts here?