Created
July 16, 2017 08:13
-
-
Save anonymous/a59d0e5802aee6ad228c6d7dbc337263 to your computer and use it in GitHub Desktop.
Child pages next/prev links ( Unsupported )
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
add_action( 'genesis_entry_footer', 'link_child_pages' ); | |
function link_child_pages() { | |
global $post; | |
$pagelist = get_pages("child_of=".$post->post_parent."&parent=".$post->post_parent."&sort_column=menu_order&sort_order=asc"); | |
$pages = array(); | |
foreach ($pagelist as $page) { | |
$pages[] += $page->ID; | |
} | |
$current = array_search($post->ID, $pages); | |
$prevID = $pages[$current-1]; | |
$nextID = $pages[$current+1]; | |
?> | |
<div class="navigation"> | |
<?php if (!empty($prevID)) { ?> | |
<div class="previous"> | |
<a href="<?php echo get_permalink($prevID); ?>" title="<?php echo get_the_title($prevID); ?>">Previous</a> | |
</div> | |
<?php } | |
if (!empty($nextID)) { ?> | |
<div class="Next"> | |
<a href="<?php echo get_permalink($nextID); ?>" title="<?php echo get_the_title($nextID); ?>">Next</a> | |
</div> | |
<?php } ?> | |
</div> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment