Created
March 8, 2012 01:23
-
-
Save justinwhall/1997825 to your computer and use it in GitHub Desktop.
PHP: WordPress | Get children pages AND the sibling pages ONLY when on child pages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get children pages AND the sibling pages ONLY when on child pages | |
if($post->post_parent) | |
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&sort_column=menu_order&depth=1"); | |
else | |
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&sort_column=menu_order&depth=1"); | |
if ($children) : | |
?> | |
<div id="child-menu" > | |
<ul> | |
<?php echo $children; ?> | |
</ul> | |
</div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment