-
AuthorPosts
-
December 3, 2013 at 9:41 pm #195885
Hi,
I have built a portfolio in witch I show only one category of items (Parcours”
When I click on an item in my portfolio page, I move to the page showing my portfolio item as a single entry.
Problem is that the left and right buttons allow user to go to previous or next portfolio item, whatever the category.Is it possible to limit the navigation to the portfolio items of the same category ?
Thanks
December 4, 2013 at 10:30 am #196057Hey totofunk!
Please add this on functions.php:
add_filter('avia_post_nav_categories', 'avf_same_category_filter'); function avf_same_category_filter($same_category) { $same_category = true; return $same_category; }
Best regards,
IsmaelDecember 12, 2013 at 2:35 am #199323Would this also work if you want to only be able to navigate a few of the categories? For instance, only allow it to go from categories 1,2,3 and not 4 or 5. Say, something like this:
add_filter(‘avia_post_nav_categories’, ‘avf_same_category_filter’);
function avf_same_category_filter($same_category)
{
$same_category = true;
return $category1, category2, category3;
}??
December 12, 2013 at 9:19 am #199393Hi!
No, it doesn’t work like that. It will only navigate posts or portfolio items which share the same category. You can create a unique category for portfolio items then add it on items with category 1, category 2 and category 3.
Best regards,
IsmaelNovember 18, 2015 at 5:46 pm #538380Can you tell me where I must add this code on functions.php?
thanksNovember 19, 2015 at 7:47 am #538778January 27, 2017 at 3:37 pm #739419I have the same problem: After selecting a portfolio item you can only browser through all portfolio items. It is not limited to the categoriy of the selected item. I’ve tried the script above, but it doesn’t work.
I’ve also found this: https://kriesi.at/support/topic/previousnext-buttons-on-portfolio-items-restrict-to-1-category/#post-177888. The post at the end of this dialogue says: It doesn’t work, but might be fiexed in WP 3.7 or 3.8.
Now we have WP 4.7.2 and it isn’t fixed until now(?). Is there still no possibility, that the user clicks a portfolio item e.g. “Websites” and than he or she only can browse through all “Website” portfolio items?
Thank you, Jan
February 1, 2017 at 5:15 am #740975Hey!
Please add this in the functions.php file.
add_filter('avia_post_nav_settings', 'avia_post_nav_settings_mod'); function avia_post_nav_settings_mod($settings) { if(is_singular('portfolio')) { $settings['taxonomy'] = 'portfolio_entries'; $settings['is_fullwidth'] = false; } $settings['same_category'] = true; return $settings; }
The code is not working because it was intended to be used for product post type.
Cheers!
IsmaelFebruary 4, 2017 at 9:08 am #742717Thanks, Ismael. It works.
February 4, 2017 at 10:30 am #742747Hey,
Glad we could help :)
Regards,
Nikko -
AuthorPosts
- The topic ‘limit portfolio navigation to a single category in single item view’ is closed to new replies.