Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1171998

    Hi I’m building a site for a client who sells antiques.

    I am using the portfolio post to showcase her inventory.

    People can make an enquiry to buy an item. (no ecommerce)

    Once the item is sold we want to hide the portfolio post from the front end but still have it available should an old link/search term still link to it.

    I have created a Portfolio category called Archive and the portfolio grids are set up NOT to display the category Archive. All good so far.

    The problem comes with the next/previous buttons to the left and right of the screen. If a user uses these they scroll through all of the portfolio posts across all portfolio categories.

    Is there a way to stop these buttons calling portfolio post with the archive category or only show posts from particular/selected categories?

    Any ideas welcome.

    Best

    Dominic

    #1172039

    Managed to use this. It’s not exactly what I want but its quite good. It shows all posts from same category rather than excluding just one. Let me know if anyone has any other thoughts.

    D

    /* make previous-next buttons stay within the relevant portfolio category (multiple portfolios) */
    add_filter( 'avia_post_nav_entries', 'enfold_customization_postnav', 10, 2);
    function enfold_customization_postnav($entries, $settings)
    {
    if($settings['type'] == 'portfolio')
    {
    $settings['same_category'] = true;
    $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;
    }
    #1172330

    Hi domchocolate,

    Thanks for posting the solution that worked for you, here’s some suggestion since avia_post_nav_entries is deprecated, please use avf_post_nav_entries in version 4.5.6 and above. Also I think $entries[‘prev’] and $entries[‘next’] isn’t needed, here’s another version of your code which works similarly:

    add_filter( 'avf_post_nav_entries', 'enfold_customization_postnav', 10, 2);
    function enfold_customization_postnav($entries, $settings)
    {
      if($settings['type'] == 'portfolio')
      {
        $settings['same_category'] = true;
      }
      return $entries;
    }

    Best regards,
    Nikko

    #1172730

    Hi I tried that code and it didn’t work. I am using Version: 4.6.3.1 of Enfold. I reverted back to old code.

    Any thoughts?

    #1173479

    Hi domchocolate,

    Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?

    Best regards,
    Victoria

    #1173504

    Hi domchocolate,

    I apologize for the mistake, it should be this code:

    add_filter( 'avf_post_nav_settings', 'enfold_post_nav_settings', 10, 2);
    function enfold_post_nav_settings($settings)
    {
      if($settings['type'] == 'portfolio')
      {
    	$settings['same_category'] = true;
      }
      return $settings;
    }

    Best regards,
    Nikko

    #1174947

    That’s done it – thanks Nikko!

    #1174950

    Hi,

    Glad Nikko could help! Let us know if you have any other questions or issues :)

    Best regards,
    Yigit

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Previous/Next Portfolio post buttons’ is closed to new replies.