Forum

Thread tagged as: Problem, Runway

listing random sub categories only

I'm using this to output a random list of category links:

                    perch_categories(array(
                        'set'=> 'categories',
                        'template' => 'category_list.html',
                        'count' => 8,
                        'sort-order'  => 'RAND',
                    ));

Is there some way to limit the output to sub categories only, i.e. filter out the parent categories?

I need catPath's with 3 slashes not 2, i.e. 'categories/parent-category/sub-category/' but not 'categories/parent-category/'

Any help much appreciated!

Adam Green

Adam Green 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to set sort for sort-order to be used. Try

'sort' => 'catID',
'sort-order'  => 'RAND',

mmm thanks for that; it was working without sort being set for some reason, but still lists a random selection of all categories. I need to list only sub-categories - is there a way to check for more than 2 slashes in catPath? Using regex or levels (like perch_pages_navigation)?

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, I don't think so.