Answers.Body: <p>The code above is correct and working properly. There was a conflict with a masonry js file making the Craft ordering not work. Big thanks to @Anubarak for testing the code on their side.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-18T17:35:08.713Z
Answers.LastActivityDate: 2017-10-18T17:35:08.713Z
Answers.UserDisplayName: Jon Livingston
Body: <p>I'm stumped trying to order paginated entries for a channel. The end goal is to have listings with the most recent postDate at the top. The code below has the most recent item third instead of first. The first item should be third.</p>
  
  <p>The same happens as you paginate to the next page. The third item listed should be the first item listed.</p>
  
  <pre><code>{% paginate craft.entries.section('podcastEpisodes').order('postDate desc').limit('3') as pageInfo, pageEntries %}
  {% for entry in pageEntries  %}
  
  {% set category = entry.topic.first() %}
      &lt;div class="masonry__item" data-masonry-filter="{% if category %}{{ category.title }}{% endif %}"&gt;
  
      &lt;article&gt;
          &lt;p class="date"&gt;{{ entry.postDate|date('M j, Y') }}&lt;/p&gt;
  
          {% set myEntry = entry.podcaster.first() %}
          {% if myEntry %}
          &lt;p class="podcaster"&gt;{{ myEntry.title }}&lt;/p&gt;
          {% endif %}
  
          &lt;h4&gt;{{ entry.title }}&lt;/h4&gt;
      &lt;/article&gt;
  
      &lt;/div&gt;
  {% endfor %}
  </code></pre>
  
  <p>Any idea why this is happening?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-18T04:51:36.770Z
Comments.Text: What happens when you try to use dateCreated instead of postDate?
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-18T12:23:17.800Z
Comments.Text: Same thing happens. The most recent entry is third on list, with the third entry in the first spot (when limiting it to 3 entries per page).
Comments.UserDisplayName: Jon Livingston
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-18T12:48:29.287Z
Comments.Text: Really strange, when I copy your code, remove the category and myEntry part and change `podcastEpisodes` to a sectionhandle of my system it works. Do you see the correct order in your backend? Maybe you could search in your database if the entries have the correct postDate there.
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-18T17:32:44.967Z
Comments.Text: @Anubarak - Thank you! Your comment made me realize there was something larger going on. I found a masonry js file that was sorting entries differently than Craft. The code above is correct and working properly now that the js file was changed.
Comments.UserDisplayName: Jon Livingston
Tags: <pagination><ordering><postdate>
Title: Order a paginated entry by postDate
ThreadText: # Order a paginated entry by postDate
  
  (Asked by: username_0 on 2017-10-18)
  
  I'm stumped trying to order paginated entries for a channel. The end goal is to have listings with the most recent postDate at the top. The code below has the most recent item third instead of first. The first item should be third.
  
  The same happens as you paginate to the next page. The third item listed should be the first item listed.
  
  ```
  {% paginate craft.entries.section('podcastEpisodes').order('postDate desc').limit('3') as pageInfo, pageEntries %}
  {% for entry in pageEntries  %}
  
  {% set category = entry.topic.first() %}
      <div class="masonry__item" data-masonry-filter="{% if category %}{{ category.title }}{% endif %}">
  
      <article>
          <p class="date">{{ entry.postDate|date('M j, Y') }}</p>
  
          {% set myEntry = entry.podcaster.first() %}
          {% if myEntry %}
          <p class="podcaster">{{ myEntry.title }}</p>
          {% endif %}
  
          <h4>{{ entry.title }}</h4>
      </article>
  
      </div>
  {% endfor %}
  
  ```
  
  Any idea why this is happening?
  
  **Tags:** pagination, ordering, postdate
  
  > **Comments:**
  > **username_1**: What happens when you try to use dateCreated instead of postDate?  
  > **username_0**: Same thing happens. The most recent entry is third on list, with the third entry in the first spot (when limiting it to 3 entries per page).  
  > **username_1**: Really strange, when I copy your code, remove the category and myEntry part and change `podcastEpisodes` to a sectionhandle of my system it works. Do you see the correct order in your backend? Maybe you could search in your database if the entries have the correct postDate there.  
  > **username_0**: @Anubarak - Thank you! Your comment made me realize there was something larger going on. I found a masonry js file that was sorting entries differently than Craft. The code above is correct and working properly now that the js file was changed.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-10-18. Score: 2
  
  The code above is correct and working properly. There was a conflict with a masonry js file making the Craft ordering not work. Big thanks to @Anubarak for testing the code on their side.
  
  
  ---
  
  