Hello!
I believe the solution to what you are trying to accomplish is in the link below.
https://codex.wordpress.org/Next_and_Previous_Links
Let me know if this helps you implement this within your website!
Hi David!
I modified the code to fit my needs, building it around custom field values:
$args= array(
'meta_query' => array(
array(
'key' => 'type',
'value' => 'apple',
))
);
$pagelist = get_pages($args);
$pages = array();
foreach ($pagelist as $page) {
$pages[] += $page->ID;
}
$current = array_search(get_the_ID(), $pages);
$prevID = $pages[$current-1];
$nextID = $pages[$current+1];
<a href="<?php echo get_permalink($prevID); ?>" title="<?php echo get_the_title($prevID); ?>">Previous</a>
<a href="<?php echo get_permalink($nextID); ?>" title="<?php echo get_the_title($nextID); ?>">Next</a>
The above script works, but it completely ignores the meta key/value parameters to narrow down the list of pages to jump to.