Hi,
How can I show only products of same categories in previous and next product arrows in the product page?
Thank you
Best regards,
Salvatore
Hey integraing!
Try this out, https://kriesi.at/support/topic/avia-post-nav-to-show-only-same-category-posts/#post-478687.
Best regards,
Elliott
Hey Elliot, i have wrote the following code in functions.php, but it doesn’t work.
add_filter('avia_post_nav_categories', 'use_same_category_filter');
function use_same_category_filter($same_category)
{
$same_category = true;
return $same_category;
}
I have read that the filter in Enfold has changed a bit (https://kriesi.at/support/topic/avia-post-nav-with-the-same-category-not-work), and so i have wrote the following code in functions.php.
With this function Enfold doesn’t show the arrows to change product, also if there is another product in the same category.
add_filter('avia_post_nav_settings','avia_same_category_filter', 10, 1);
function avia_same_category_filter($settings) {
$settings['same_category'] = true;
return $settings;
}
thank you
best regards
Salvatore
Hey!
Please use this instead:
add_filter('avia_post_nav_settings','avia_same_category_filter', 10, 1);
function avia_same_category_filter($settings) {
if(is_singular('product')) {
$settings['taxonomy'] = 'product_cat';
$settings['same_category'] = true;
}
return $settings;
}
This is only going to work if the products are not included on multiple product categories.
Cheers!
Ismael