If Child Pages Help
-
Hi there all.
I am developing some themes and want to have a page whereby a list of child pages is displayed in the sidebar if the page has any child pages. If the page does have child pages this list will be shown in the sidebar on the parent page and the child pages. This is easy, as using this page in the codex:
has the code for that:
<?php if($post->post_parent) $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>
What i want to be able to do is to modify this code so that if the page does not have child pages, then I can display an archive list (monthly). Must be something to do with elseif? but I can’t quite get my head round it. Any help would be greatly appreciated.
Thanks in advance.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘If Child Pages Help’ is closed to new replies.