Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #568733

    Hi guys

    I have reordered my portfolio items so they are alphabetized in the side navigation (using post types order plugin – doesn’t seem to be the default in the theme?). I would like to be able to limit which items are visible there – is it possible to sort it / hide portfolio categories? I have items from 2015 that I don’t want in this year’s navigation, and the same will be the case in 2017.

    thanks for your help
    Nancy

    #569658

    Hi Munford!

    You can use this code to make it so the post nav show only posts within the same category:

    add_filter('avia_post_nav_categories', 'use_same_category_filter');
    function use_same_category_filter($same_category) {
    $same_category = true;
    return $same_category;
    }

    Regards,
    Josue

    #569919

    thanks – do I need to specify somewhere that I want only “2016” category?

    #570197

    Hey!

    To clarify, when you are on an item with “2016” category, post navigation will only go through the posts with the same category.

    Regards,
    Yigit

    #570216

    yes, that’s what I want.

    #570217

    should that go in the functions.php?

    #570228

    Hi!

    Yes, please add the code Josue posted into functions.php file in Appearance > Editor

    Best regards,
    Yigit

    #570267

    thanks – I added that but am not seeing what I wanted.
    the page linked below should be the last item in the category “2016” but the side nav continues to the next item which is in “2015”

    #570680

    Hi,

    Can you please create us a WordPress administrator account? post it here as a private reply.

    Regards,
    Josue

    #570739

    sure thanks for taking a look

    #571952

    Hey!

    We modified the code a bit. Please remove browser cache or hard refresh the page.

    Cheers!
    Ismael

    #571997

    Thanks – seemed to work regarding the categories, but the order of the portfolio items is now reversed (Z – A instead of A – Z) – can that be fixed?

    thanks!

    #572713

    Hey!

    Alright. We modified the code again.

    add_filter('avia_post_nav_settings','avia_same_category_filter', 10, 1);
    function avia_same_category_filter($settings) {
         $settings['same_category'] = true;
         return $settings;
    }
    
    add_filter( 'avia_post_nav_entries', 'enfold_customization_postnav', 10, 2);
    function enfold_customization_postnav($entries, $settings) {
    	$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;
    }
    

    Cheers!
    Ismael

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.