We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum


Thread tagged as: Problem, Configuration

Filter Perch Collection with perch_page_attribute


I'd like to show a subset of the items in a collection on various pages in our site.

Id like to pass the value of page attribute to the perch collection, however this doesn't seem to work. Is there another way I can achieve this?

Here is the code that I'm using in the Master Page Template


$TourFilter = perch_page_attribute('filter', true);

perch_content('Page Body');

  'template' => 'tours_page_destination.html',
    'value'=> $TourFilter,
    'sort' => 'destinationsort_australia',
  'sort-order' => 'ASC',
  'count' => 99



At the moment, the perch_page_attribute is outputted to the page only. I've referred to https://docs.grabaperch.com/functions/page-attributes/perch-page-attribute/ but must be doing something wrong.

Am running latest version of Runway

Many thanks

Regards James

James Ng

James Ng 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support


$TourFilter = perch_page_get_attribute('filter');

Thanks Drew .. that did the trick!