Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #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

    #196057

    Hey 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,
    Ismael

    #199323

    Would 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;
    }

    ??

    #199393

    Hi!

    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,
    Ismael

    #538380

    Can you tell me where I must add this code on functions.php?
    thanks

    #538778

    Hi @gebca,

    Please try at the very bottom of the file.

    Best regards,
    Rikard

    #739419

    I 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

    #740975

    Hey!

    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!
    Ismael

    #742717

    Thanks, Ismael. It works.

    #742747

    Hey,

    Glad we could help :)

    Regards,
    Nikko

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘limit portfolio navigation to a single category in single item view’ is closed to new replies.