# Sorting listed() elements

**URL:** <https://forum.getkirby.com/t/sorting-listed-elements/17295>\
**Category:** Questions\
**Tags:** v3\
**Created:** [February 17, 2020, 10:16am UTC](https://forum.getkirby.com/t/sorting-listed-elements/17295 "2020-02-17T10:16:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anta](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/anta/32/13394_2.png) [@anta](https://forum.getkirby.com/u/anta)\
**Post date:** [February 17, 2020, 10:16am UTC](https://forum.getkirby.com/t/sorting-listed-elements/17295/1 "2020-02-17T10:16:30Z")

</div>

Hi,  
I’m looping my posts like this:

` <?php foreach (page('photography')->children()->listed() as $album): ?>`

How can I sort them so instead of going descendent they go ascendent? I don’t want to use sortBy() simply show them like how they appear in the panel but in the opposite order.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![nilshoerrmann](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/nilshoerrmann/32/6005_2.png) [@nilshoerrmann](https://forum.getkirby.com/u/nilshoerrmann)\
**Post date:** [February 17, 2020, 10:24am UTC](https://forum.getkirby.com/t/sorting-listed-elements/17295/2 "2020-02-17T10:24:26Z")

</div>

Have a look at `flip`:

> **[$pages-\>flip()](https://getkirby.com/docs/reference/objects/pages/flip)**
>
> Returns the elements in reverse order

---

<div class="post-metadata">

**Author:** ![anta](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/anta/32/13394_2.png) [@anta](https://forum.getkirby.com/u/anta)\
**Post date:** [February 17, 2020, 10:46am UTC](https://forum.getkirby.com/t/sorting-listed-elements/17295/3 "2020-02-17T10:46:37Z")

</div>

It was that easy… thanks and sorry for perhaps not investigating enough before asking!
