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: Question

Perch Custom Content sort


I'm using perch_content_custom to use the region name from a set of pages and then show these pages in a list.

I'm trying to sort these by the order those pages appear in the admin but it doesn't seem to be able to do this. Is there a way to make this happen?

I've also tried sorting by name in ascending / descending order but my names are all Unit 1, Unit 2 etc and I'm finding that whenever it gets to Unit 10, Unit 10 is listed before Unit 2 ie. Unit 1, Unit 10, Unit 2

Any help would be appreciated.

Peter Meenagh

Peter Meenagh 0 points

  • 5 years ago

what about using x100 lists ie 001 ~ 010

Hi Ian

Thanks for the reply. What would the code look like for this?

It's currently like this

perch_content_custom('Property Content', array(
'sort' => 'propertystatus',

Hi Looks pretty good. I would imagine "propertystatus" to be a search rather than a sort field... Which would require a binary value. ie on off

I presume there are multiple properties either occupied / sold or available? ??

Drew McLellan

Drew McLellan 2638 points
Perch Support

There's not currently a way to sort content based on the order of the page on which it exists.

Ian sorry I posted up the wrong sort here it should be propertyname instead. Each property is called Unit 1 - Unit 15 but when sorted by propertyname it is listed like Unit 1, Unit 10, Unit 11. Not sure if there's anyway to sort this.

<?php perch_content_custom('Property Content', array( 'page'=>'/property/tenant-directory/*', 'template'=>'tenant_list.html', 'sort' => 'propertyname', 'sort-order'=>'DESC', )); ?>

Hi Drew

Is there anyway to list the property names in the correct order Unit 1, Unit 2 etc rather than Unit 1, Unit 10, Unit 11 etc?

Your help is much appreciated.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You can switch to numeric ordering, yes:

'sort-type' => 'numeric',

Brilliant thanks Drew