Forum

Thread tagged as: Question

Getting "next item" when using categories/perch_content_custom

Hi,

I'm displaying individual content regions (for a "case studies" section of a site) in a very similar way as described in this video: https://docs.grabaperch.com/video/v/portfolio-with-categories/

I have article.php with this code:

perch_content_custom('Case Studies', array(
      'page' => '/case-studies/index.php',
      'template' => 'case_study.html',
      'filter' => 'slug_custom',
      'match' => 'eq',
      'value' => perch_get('s'),
      'count' => 1,
    ));

It all works fine and the categories all link up beautifully. However, on article.php I'd like to be able to get the url for the next case study (e.g. a "next case study" button). The problem being that because I'm only getting 1 item, it has no way to paginate for the next item.

My approach is going to be to use skip-template to get an associative array of the entire set, grab the '_id' of the current item to therefore find the next item in the array. I'm pretty sure this will work but it feels clunky.

Any other suggestions?

Thanks!

Digital Team

Digital Team 0 points

  • 6 years ago