Custom List Pages Argument
-
Hi Guys, I wonder if anybody can help me out here…
I want to display the sub pages of the given page. Then if I am on a subpage, I want to display the other pages on that level beneath the page parent. Here’s the code I have so far…
<?php $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0'); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } else; { ?> //need an argument here to say display pages on the same level as current page <?php } ?>Hopefully that make sense, I’ve tried a few methods but just can’t seem to get both arguments firing correctly.
-
Hi,
Refer these articles:
http://codex.ww.wp.xz.cn/Pages#Creating_Your_Own_Page_Templates
http://codex.ww.wp.xz.cn/Theme_Development#Defining_Custom_TemplatesThanks,
Shane G.
Thanks for that, are you suggesting I use 2 different page templates?
I’m really trying to keep this as lightweight as possible and would much prefer to use one template.
Any other suggestions?
I don’t think I explained myself well enough in my original post. My page hierarchy is like this…
About -> James
Tim
DavidSo If I am on the about page I want to display, James, Tim and David. If I am on either the James, Tim or David page still want to display the same pages (James, Tim, David).
Just wondered if I am on the right track with this code…
<?php $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0'); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } else; { ?> //need an argument here to say display pages on the same level as current page <?php } ?>
The topic ‘Custom List Pages Argument’ is closed to new replies.