Forum

Thread tagged as: Question

Sorting by page order

Using perch_content_custom, I'm trying to sort a region from multiple pages by page order set in the admin interface. This way, I would be able to reorder the pages in the admin, then use a sort value in perch_content_custom to list the results accordingly. Is this possible?

By default, they appear in the order I post the pages, starting with the last post first.

This doesn't seem to work:

<?php
     perch_content_custom('Main content', array(
     'page'=>'/custom-web-sites/*',
     'template'=>'web_site_project_list.html',
     )); 
?>

nor does this:

<?php
     perch_content_custom('Main content', array(
     'page'=>'/custom-web-sites/*',
     'template'=>'web_site_project_list.html',
     'sort'=>'_order',
     )); 
?>
Robert Yedlin

Robert Yedlin 1 points

  • 7 years ago

Forgot to add e-mail notifications. Replying so I can check that off.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You can't sort items by the order of their page, no.

Ok, so if I want to control the order of them using perch_content_custom, I would need to put an "order" field in the region and then sort by that? Would you recommend a specific way of doing that?

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's not something I've ever done, so I don't have a specific recommendation. But yes, generally speaking that's what you'd need to do.

Ok, thanks!