thomas Posted September 14, 2015 Share Posted September 14, 2015 Hello, my client wants to schedule his posts and since I haven't had any issues with 2.6.16 in development I decided to update his site to the dev version in order to use "publish" date. The DB was properly updated, "published" shows up in the pages table, I can use $page->published but $pages->find("sort=-published") doesn't seem to work. Is this correct or am I missing something? Thanks, thomas Link to comment Share on other sites More sharing options...
kongondo Posted September 14, 2015 Share Posted September 14, 2015 (edited) Haven't looked into the implementation yet but you are right; it seems not to be working. However, sorting the PageArray itself works for me, i.e. $pages->find('template=basic-page')->sort('-published'); Not exactly what you are after, but just thought to point that out... Edited September 14, 2015 by kongondo Clarified post Link to comment Share on other sites More sharing options...
thomas Posted September 14, 2015 Author Share Posted September 14, 2015 It does? For me it definitely doesn't. I use $pages->find("template=article,sort=-published,limit=3") and it sorts by created. No matter if I use "published" or "-published". I use 2.6.17 now btw Link to comment Share on other sites More sharing options...
kongondo Posted September 14, 2015 Share Posted September 14, 2015 Look at my code...that's an in-memory sort (i.e. the sort is happening outside the database, after the items have already been fetched). In other words, and I should have been clearer, sort within the selector is not working for me either, just as you described Link to comment Share on other sites More sharing options...
thomas Posted September 14, 2015 Author Share Posted September 14, 2015 Ah, alright. Thanks for the clarification. You are right, that's not exactly what I'm looking for since I need to pick the latest 3 articles from 2354 ... Link to comment Share on other sites More sharing options...
Neo Posted August 22, 2017 Share Posted August 22, 2017 Can you now select and sort by publication date of a page? I am looking for something like: $pages->find("template=MyTemplate, limit=15, sort=-published"); The documentation does not seem to list "published" and only shows "created": http://cheatsheet.processwire.com/selectors/ Link to comment Share on other sites More sharing options...
abdus Posted August 22, 2017 Share Posted August 22, 2017 7 minutes ago, Neo said: now Sorting by published works for the last two years or so. (Not sure about before that or about PW 2.6 though) $pages->find('template=MyTemplate, limit=15, sort=-published') most certainly works. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now