Created
June 7, 2013 10:30
-
-
Save keeev/5728416 to your computer and use it in GitHub Desktop.
Get ancestor Pages to current page
This file contains 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 | |
$ancestors = get_post_ancestors($post); | |
if (count($ancestors) >= 1) { // add your hierarchy here | |
$parent = $ancestors[0]; | |
} | |
elseif (count($ancestors) >= 2) { | |
$parent = $ancestors[0]; | |
} | |
if ($parent) { | |
$tabs = wp_list_pages('depth=1&sort_column=menu_order&sort_order=desc&child_of=' .$parent."&title_li="); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment