I'm writing some custom functions to skip blank pages when generating navigation links. So I'm copying and modifying the previous/next link functions into our theme. The code in the plugin's link to next page function includes this
if ($nextPage = $exhibitPage->firstChildOrNext()) {
$targetPage = $nextPage;
} elseif ($exhibitPage->parent_id) {
$parentPage = $exhibitPage->getParent();
$nextParentPage = $parentPage->next();
if ($nextParentPage) {
$targetPage = $nextPage;
}
}
Is there a reason for setting the targetPage to nextPage after checking for a valid nextParentPage? It just doesn't look right to me. It seems that you'd want to set targetPage to nextParentPage after identifying that it exists.