Forum

Thread tagged as: Question, Runway

Filtering By Category Set in Blog Archive

Hi

Is it possible to filter by category set using perch_blog_custom on the blog archive template?

So instead of listing all the full category paths, which will be added to over time, you can filter by the set to display all categories within that set?

Something like...

perch_blog_custom([
            'category'   => array('departments/*', 'offices/*'),
            'template'   => $template,
            'count'      => $posts_per_page,
            'sort'       => $sort_by,
            'sort-order' => $sort_order,
        ]);

Many thanks

Glen

Glen Piggott

Glen Piggott 0 points

  • 3 years ago

I've managed to get it to work like so. Not sure if it's the best way, but it works!

perch_blog_custom([
            'category'   => array('departments/'.perch_get('cat'), 'offices/'.perch_get('cat')),
            'template'   => $template,
            'count'      => $posts_per_page,
            'sort'       => $sort_by,
            'sort-order' => $sort_order,
        ]);
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that looks fine.