Hi All
To keep my sidebar list of pages as compact as possible, I would like to show the subpages/children ONLY for the parent page that I am already on. And of course while on any of the children pages of that parent.
Best - Anders.
Hi All
To keep my sidebar list of pages as compact as possible, I would like to show the subpages/children ONLY for the parent page that I am already on. And of course while on any of the children pages of that parent.
Best - Anders.
I think this might do what you want:
http://www.scriptygoddess.com/archives/2009/02/10/show-subnavigation-for-just-the-main-navsection-youre-in-wordpress/
Hi Scripty - I found your link and copied and pasted this into the sidebar of my site:
<?php
if ($post->post_parent == 0) {
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
$parentpage = $wpdb->get_row("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE ID = '".$post->ID."'");
}
if ($post->post_parent != 0) {
$next_post_parent = $post->post_parent;
while ($next_post_parent != 0) {
$children = wp_list_pages("title_li=&child_of=".$next_post_parent."&echo=0");
$parentpage = $wpdb->get_row("SELECT ID, post_title, post_parent, post_name FROM $wpdb->posts WHERE ID = '".$next_post_parent."'");
$next_post_parent = $parentpage->post_parent;
}
}
?>
<?php if ($children) { ?>
<?php } ?>
But nothing happens. What I'd like is to have the same set up you have - I'm using the simpleX theme, and my link is http://www.transformationacceleration.com --- I know that WordPress is supposed to be simple, but I don't understand what I'm doing at all.
I would be very grateful for any help you or anyone else could give me about how to make the parent-child page list show up in my sidebar. And my other question is, should that happen, will I automatically be able to go to the admin page and put in content?
This might be just what you are looking for. Replace the standard Pages widget with:
This topic has been closed to new replies.