Hi,
I have Portfolio Items in two categories; interior and exterior.
The Next/Previous tabs seem to cross the categories; meaning that visitors navigate to a different category on this link:
https://orangerieduras.fr/portfolio-item/orangerie-staircase/
Can this function be limited to the same category, so that ‘Next’ loops back to the first Portfolio Item in the category?
Thanks,
Simon
OK – I found the fix for this, and it took some digging so I’m leaving this post up with the solution, which works (so please close the ticket)!
/* make previous-next buttons stay within the relevant portfolio category (multiple portfolios) */
add_filter( 'avia_post_nav_entries', 'enfold_customization_postnav', 10, 2);
function enfold_customization_postnav($entries, $settings)
{
if($settings['type'] == 'portfolio')
{
$settings['same_category'] = true;
$entries['prev'] = get_next_post($settings['same_category'], $settings['excluded_terms'], $settings['taxonomy']);
$entries['next'] = get_previous_post($settings['same_category'], $settings['excluded_terms'], $settings['taxonomy']);
}
return $entries;
}