Search the blog

Here’s how you can sort pages as they appear in the CMS when using the ProcessWire API. This is useful because if you aren’t using children() the ordering of your pages won’t usually be correct.

wire('pages')->find('template=page, sort=sort')

The key part of the selector is the sort=sort part.

Tim Bennett is a freelance web designer from Leeds. He has a First Class Honours degree in Computing from Leeds Metropolitan University and currently runs his own one-man web design company, Texelate.