Jump to content
thomas

2.6.16 publish date: Not yet in sort selector?

Recommended Posts

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

Share this post


Link to post
Share on other sites

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 by kongondo
Clarified post

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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  :-)

Share this post


Link to post
Share on other sites

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 ... 

Share this post


Link to post
Share on other sites

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/

 

Share this post


Link to post
Share on other sites
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.

  • Like 1

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...