<p><code>positionedAfter</code> only applies to entries within a structure section (<a href="https://craftcms.com/docs/templating/craft.entries#positionedAfter" rel="nofollow noreferrer">https://craftcms.com/docs/templating/craft.entries#positionedAfter</a>). See <a href="https://craftcms.stackexchange.com/a/58/642">this answer</a> for how to get next and previous entries.</p>

CC BY-SA 3.0
2017-09-27T12:10:34.360Z
Thanks that answer helped, but I still see problem in craft core because I am using structure and order is wrong for positionedAfter and positionedBefore
Andris
CC BY-SA 3.0
2017-09-27T12:49:35.593Z
`positionedAfter` and `positionedBefore` will return the entry before/after in the Structure in the CMS, regardless of how you order them on the front end using `.order()`. If you're using this for a blog, you should be using a channel rather than a structure.
darylknight
CC BY-SA 3.0
2017-09-27T11:44:48.150Z
2017-09-27T11:44:48.150Z
darylknight
<p>I'm trying to get prev/next entry using positionedAfter and positionedBefore filters but getting weird order on results because order('postDate desc') seems to be ignored.</p>

<pre><code>{% set prevSibling = craft.entries.positionedAfter(entry).order('postDate desc').first() %}

{% set nextSibling = craft.entries.positionedBefore(entry).order('postDate desc').first() %}
</code></pre>

<p>Can anyone help?</p>

<entries><ordering><previous-next>
Entries order postDate not working
# Entries order postDate not working

(Asked by: username_0 on 2017-09-27)

I'm trying to get prev/next entry using positionedAfter and positionedBefore filters but getting weird order on results because order('postDate desc') seems to be ignored.
{% set prevSibling = craft.entries.positionedAfter(entry).order('postDate desc').first() %}

{% set nextSibling = craft.entries.positionedBefore(entry).order('postDate desc').first() %}

Can anyone help?

**Tags:** entries, ordering, previous-next

---

## 1 answers

### Answer by username_1 on 2017-09-27. Score: 2

`positionedAfter` only applies to entries within a structure section (<https://craftcms.com/docs/templating/craft.entries#positionedAfter>). See [this answer](https://craftcms.stackexchange.com/a/58/642) for how to get next and previous entries.

> **Comments:**
> **username_0**: Thanks that answer helped, but I still see problem in craft core because I am using structure and order is wrong for positionedAfter and positionedBefore  
> **username_1**: `positionedAfter` and `positionedBefore` will return the entry before/after in the Structure in the CMS, regardless of how you order them on the front end using `.order()`. If you're using this for a blog, you should be using a channel rather than a structure.  

---

