Keyword

right sorting for my k2 articles

More
13 years 1 month ago #98982 by testa
right sorting for my k2 articles was created by testa
hi,

sometimes it happens that I have to input messages from the last 3 or 4 days.

then I usually change the creation date at k2 and hope they come in the right order... but they don't.

they are always sorted in the way that I inputted them. Is there a way to have the sorting at the created date?

I saw different settings like oldest first and so on in the k2 options but none of them made my articles sort in the way I wanted :( any ideas?

 

Please Log in or Create an account to join the conversation.

More
13 years 1 month ago #98983 by Martin Zenker
Replied by Martin Zenker on topic right sorting for my k2 articles
The main problem is, that K2 uses ordering by ID as standard-ordering, but does not offer (don't ask me why...) the ordering by creation date as an option, at least not with most recent first. That is an error in the backend, that seems to be very frustrating for many people.

 

Easy solution for now: set standard ordering to most recent first.

Done in one line of php.

open: component/com_k2/models/itemlist.php

 

change line 258 (directly under "default:") from


$orderby = 'i.id DESC';

 

to

 

$orderby = 'i.created DESC';

 

Save and done. Now all you have to do is to change ordering to standard to see the most recent articles where they should be: up front.

 

Can't believe that so many Google searches did not bring me any better solution - but that one works. All that counts.

 

Good luck to ya all.

Martin

Please Log in or Create an account to join the conversation.

  • Kannan Naidu Venugopal
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
13 years 1 month ago #98984 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic right sorting for my k2 articles
I've sorted K2 items without doing the hack above but let me get a clearer view. You have 2 articles published today and you have another few published 2 days later, now you want to publish an article in between or earlier and it doesn't sort out according to the published date ?

K2 Rocks \m/

Please Log in or Create an account to join the conversation.

More
13 years 1 month ago #98985 by Martin Zenker
Replied by Martin Zenker on topic right sorting for my k2 articles
At least not in standard ordering, since the new article that should stand inbetween the older ones has got the highest ID and thus will be displayed as "newest" article, unless you tell K2 to order most recent first...

Kannan Naidu said:
I've sorted K2 items without doing the hack above but let me get a clearer view. You have 2 articles published today and you have another few published 2 days later, now you want to publish an article in between or earlier and it doesn't sort out according to the published date ?

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum