Home › Forums › Calendar Products › Events Calendar PRO › Order list by startdate
- This topic has 5 replies, 2 voices, and was last updated 8 years, 9 months ago by
adformation.
-
AuthorPosts
-
June 27, 2017 at 5:46 am #1308408
adformation
ParticipantHi all!
We are using “tribe_events_list ” shortcode on our website, and we have a problem.
We can’t seem to change the order of the events – we would like it to order events by start date instead of end date.
How do we do this?Right now the dates are a mess!
Do we need to add an array to “tribe_get_list_widget_events()” – if so – what array?
We’re kind of stuck on this issue.Best regards
Aris KuckovicJune 28, 2017 at 10:13 pm #1311189Shelby
ParticipantHi there Aris,
I’m happy to help out here! 🙂
While we typically don’t provide these kinds of customizations on the forums, it does seem to be a bit of an oversight on our part that it would order by end date, so I’ll see what I can do to help here.
I’d suggest implementing the snippet found in this thread (also added below). Let me know how that goes and we’ll work from there! 🙂
<?php $args = array( 'post_type' => 'tribe_events', 'posts_per_page' => 3 ); /* add our own filter to override what the event plugin. Using a priority of 99 makes it load after the even plugin has messed with things */ add_filter( 'pre_get_posts', 'use_our_own_damn_order_value', 99 ); function use_our_own_damn_order_value( $query ) { $query->set( 'orderby', 'meta_value' ); $query->set( 'meta_key', '_EventStartDate' ); $query->set( 'order', 'ASC' ); return $query; } $our_events = new WP_Query( $args ); ?> <?php while ( $our_events->have_posts() ) : $our_events->the_post(); ?>Best,
Shelby 🙂
June 28, 2017 at 11:26 pm #1311284adformation
ParticipantHi Shelby,
Thanks for the snippet.
I’m not sure where to put it though.
The problem is in the shortcode – and no matter what I do, I can’t seem to make it work.// Retrieves the posts used in the List Widget loop. $posts = tribe_get_list_widget_events();As far as I can see – the snippet above, is what gets all the events, matching the filters in the shortcode (in this case, we use “category=”amu”). I’m a bit lost here.
Best regards
Aris KuckovicJuly 1, 2017 at 7:00 am #1314908Shelby
ParticipantHi Aris,
You should put the snippet in your functions.php file. However, if you’re not comfortable making code changes, I’d highly suggest hiring a freelancer to help you out. We also have some guidance for making changes yourself in our Themer’s Guide here. Beyond this snippet, there is not a lot of support that we can offer for customizations such as this one, so a freelancer may be helpful to have in your back pocket anyway if this gets more complex. 🙂
Cheers,
Shelby 🙂
July 23, 2017 at 9:35 am #1325094Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Order list by startdate’ is closed to new replies.
