Sorting subpages by custom page method

Hi there,
my current project contains a blueprint which has sub pages of different types. All these pages are in the same sub directory. For one page type sorting shall be done by a date field, the other one shall be sorted by other criterias of the given sub page.

My idea was to use a custom method of the given sub page models to realize the sorting (c.f. During the first tests I realized that in the panel pages are not instantiated with their correct types. Hence, the custom page method for sorting is not available.

Would the intended sorting work for the site/frontend? Are there any other suggestion how to fulfill my requirements?


Ok so by different types, I’m assuming that the different subpages use different templates? You can filter and sort quite easily on the front end by template. You can also do this in the blueprint to sort the pages in the panel, by template.

Have you tried to create a page model instead of a custom page method? I’m not quite sure if page models are respected in the Panel, but might be worth a try.

Thanks for you inputs.

@jimbobrjames: Yes, I use different templates.

@texnixe: Well, I did use a page model for my tests. I was not aware that there exists a construct named custom page methods. (Custom page methods vs. page models)

But the good thing is: Custom page methods can be used to implement custom ordering of sub pages.

In this respect my problem is solved.
Thank you very much!


I would like to define a custom page method for sorting subpages that sort on multiple fields and display this multiple fields in the left panel section. Say I have and ID-field with the value “2018030” and the title-field “MyProject-3”. Then I would like have to sorted the subpages in the left panel displayed in the following order:

“2017050 MyProjekt from the past”
“2018030 MyProject-3”

I would appreciate any (starting) hint how to define such a custom page method for sort and display. Many thanks in advance and with best regards,

Put your page method into a file called for example methods.phpand save in /site/plugins/:

page::$methods['mySortField'] = function($page) {
  return $page->id()->value() . ' ' . page->title()->value();

The you can use it in the Panel like this:

  sort: mySortField asc
1 Like

Hello texnixe

Many thanks for your hint. Your page method worked if I did not use the “->value()” method:

page::$methods['mySortField'] = function($page) {
  return $page->project_id() . '  |  ' . $page->title();

The pages do sort now correctly in the left panel.

“Unfortunately” the pages do not show-up with the combined fields in the left panel like as:

'2017050 | MyProjekt from the past'
'2018030 | MyProject-3'

How would be this feasible? Actually it is standard that for subpages in the left panel the standard field “title” is used.

Many thanks again in advance and with best regards.

Hm, that’s not possible out of the box.

As a workaround there are two plugins that could be useful:



You can then hide the pages in the sidebar with

hide: true
1 Like