Thread tagged as: Question, Docs, Perch1

How do I create a list of from all regions of a certain type

I have a Perch setup so there are treatments using a Treatment template, each one detailing a salons menu of treatments (aromatherapy etc. On the homepage I want to create a dynamic list of all these treatments types so rather than hard code I thought I would query perch for all the regions that use the Treatment template and then use the result to create a menu from each each region name.

Any ideas? I thought it might be to do with perch_content_custom

Brendan Dawes

Brendan Dawes 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't think we've got anything in perch_content_custom() that would enable you to get content from any region anywhere using a given template.

If you know the region names, then you can certainly do it by specifying the region name and a path with a wildcard to match the pages to search:

perch_content_custom('Treatment', [
    'page' => '/treatments/*',

You can even specify an array of possible names:

perch_content_custom(['Treatment', 'Mango', 'Bingo'], [
    'page' => '/treatments/*',

but we don't have an option for any region on any page I'm afraid.