-
AuthorPosts
-
October 5, 2017 at 4:48 pm #860657
Hello experts,
while a sorting of products in the shop itself is not a problem, the sorting is not used on single product pages next and previous buttons to jump to the next product.
Does anybody have an idea how to tell these buttons to also use the given product sorting ??Your help is highly appreciated !!
Thank you very much in advance !!Best regards
RalfOctober 5, 2017 at 6:25 pm #860689Hey Ralf,
Please add following code to Functions.php file in Appearance > Editor
add_filter('avia_post_nav_settings','avia_same_category_filter', 10, 1); function avia_same_category_filter($settings) { $settings['same_category'] = true; return $settings; }
Regards,
YigitOctober 6, 2017 at 7:50 am #860884Thank you Yigit,
I tried – unfortunatelly these buttons are now gone completely.
I have no idea what is wrong here.Best regards,
RalfOctober 9, 2017 at 8:56 pm #862100Hi,
Are your posts on the same category?
And make sure it is not the last post or not the first post.Best regards,
BasilisOctober 10, 2017 at 8:15 am #862344Hi Basils,
thank you for coming back to me.
These are not posts but woocommerce products and they are in the same category. So it should work somehow …Kind regards.
October 10, 2017 at 12:09 pm #862432Hi,
I found this post: https://kriesi.at/support/topic/nextprev-arrows-for-products/where this code is mentioned:
add_filter('avia_post_nav_settings', 'avia_post_nav_settings_mod'); function avia_post_nav_settings_mod($settings) { if(is_singular('product')) { $settings['taxonomy'] = 'product_cat'; } $settings['same_category'] = true; return $settings; }
This works almost fine, changing the sorting of the products to a much better order.
Now it should only take my personal sorting instead of “product_cat”.Does anybody know which configuration I have to use for that?
Thanks a lot.
October 12, 2017 at 6:10 am #863161Hi,
Now it should only take my personal sorting instead of “product_cat”
I’m sorry but that’s not possible because the navigation is based on the “get_previous_post” and “get_next_post” so it’s quite limited. It can only fetch items based on category and taxonomy.
// https://codex.wordpress.org/Function_Reference/get_previous_post
Best regards,
IsmaelOctober 12, 2017 at 9:56 am #863290OK,
thanks Ismael.
This thread can be closed.Thanks again for all your great support and help !!
-
AuthorPosts
- You must be logged in to reply to this topic.