Forum

Thread tagged as: Question

perch_categories filtering

I'd like to display a subset of all my categories. I know I can use the "set" filter like this:

<?php
    perch_categories(array(
        'set' => 'products',
    ));
?>

but what I'd really like to be able to do is to just display the children of a particular category within this set. How can I do this? I tried filtering on the path, but this didn't seem to work.

Paul Bell

Paul Bell 0 points

  • 5 years ago

Update - I think I worked this one out:

perch_categories(array(
        'set' => 'products',
        'filter' => 'catParentID',
        'match' => 'eq',
        'value' => 1
    ));

This gets me the categories I was after. I couldn't see filtering on the category parent ID in the docs anywhere, but this is working for me now in any case.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, great.