Skip to content

Instantly share code, notes, and snippets.

@kaseybon
Last active December 30, 2015 01:38
Show Gist options
  • Save kaseybon/7756985 to your computer and use it in GitHub Desktop.
Save kaseybon/7756985 to your computer and use it in GitHub Desktop.
Adds WordPress pagination to child, sibling pages. Will not add pagination to parent pages. Must be used with the Next Page, Not Next Post plugin: http://wordpress.org/plugins/next-page-not-next-post/
<?php //Add to page.php ?>
<?php if($post->post_parent !== 0) {
$nextPage = next_page_not_post();
$prevPage = previous_page_not_post();
if (!empty($nextPage) || !empty($prevPage)) {
if (!empty($prevPage)) echo '<span class="previous-sibling">'.$prevPage.'</span>';
if (!empty($nextPage)) echo '<span class="next-sibling">'.$nextPage.'</span>';
}
} ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment