Home › Forums › Calendar Products › Events Calendar PRO › Display Past Events in Reverse Order
- This topic has 5 replies, 3 voices, and was last updated 9 years, 4 months ago by Geoff.
-
AuthorPosts
-
November 14, 2014 at 12:33 pm #885103James LavineParticipant
I’m displaying a list of past events here, but I’d like it to display the most recent first. Is there a simple way to do this?
Thanks!
JamesNovember 14, 2014 at 1:38 pm #885215GeoffMemberHi there, James! Thanks for getting in touch and welcome back to the forums. 🙂
Great question. I do want to note first of all, though, that we are fairly limited in terms of helping out with custom development questions like this one. That said, we’d love to point you in the right direction if we can.
One idea would be to use use a theme override (see more on this in our Themer’s Guide) of the list.php template and use a conditional statement like this to create a new events query for past events:
if tribe_is_past() { // Run your query }
You can use tribe_get_events() to run your query and set the parameters to display past events in descending order. That might look something like this:
$events = tribe_get_events( array( 'eventDisplay' => 'past', 'order' => 'DESC', ) );
There’s a lot more detail on using tribe_get_events() here, including some handy examples. 🙂
Does that make sense? Will that work for you? Please let me know.
Cheers!
GeoffNovember 21, 2014 at 2:56 pm #894394ToddParticipantDoes that mean there’s no filter-hook to simply change the ‘order’ parameter in the DEFAULT query? Like …
add_filter(‘tec_default_query_filter’,’fix_past_list_order’);
function fix_past_list_order(){
if tribe_is_past() {
$the_default_query[‘order’] = ‘DESC’;
}
}Does a hook like “tec_default_query_filter” exist? Or do we really need to use tribe_get_events() to build a custom version of the Past-List functionality — just to change the order?
November 24, 2014 at 8:38 am #897018GeoffMemberHey there, Todd! Thanks for chiming in. 🙂
That’s certainly a good assumption and would seem likely–however, given the complexity of the many possible views and the queries supporting them, it’s not quite that easy.
We’ve been working on and trying out a new snippet that can handle this. Give it a try and see if it helps.
Cheers!
GeoffNovember 24, 2014 at 8:44 am #897025James LavineParticipantThat works perfectly! Thanks so much Geoff 🙂
November 24, 2014 at 8:58 am #897056GeoffMemberMy pleasure, James! I’m so glad that helps.
I’m going to go ahead and close this thread, but please feel free to hit us up with a new thread if any other questions pop up. We’d be happy to help. 🙂
Cheers!
Geoff -
AuthorPosts
- The topic ‘Display Past Events in Reverse Order’ is closed to new replies.