Have you tried using the tribe_get_events() function which wraps the get_posts one? There is a sample of it here
Hmmm I’ve tried that, but I’m having the exact same problem! These posts just don’t seem to wanna display in a different order :/
I use this :
eventDisplay=upcoming
orderby=EventStartDate
order=asc
Sounds like everyone here is set, based on what I’m reading in here (thanks to nofearinc for his tip too). Pealo86 found a workaround, and 7h47 has a solution too.
It seems the issue is resolved so I’m going to mark it as such right now. But if anyone disagrees with this action or needs something else down the road, please let us know and we’ll get it over with haste.
I still have the same problem as the people above. No matter what I do for order in the array, my list outputs in the order the order they were entered.
global $post;
$all_events = tribe_get_events(array(
'eventDisplay'=>'upcoming',
'posts_per_page'=>3,
'order'=>'ASC' //no matter what I change it to, no effect
));
foreach($all_events as $post) {
setup_postdata($post);
Nothing special going on there. Tried the plugin, which I’m wary of using anyhow, and no effect.
Can I set up a meta query and orderby the first date box? Can you suggest the syntax?
Hey, Watermelonkid – thanks for the note here, and sorry to hear this hasn’t done the trick. Mind sharing a link to the site (so I can get a dev to respond after taking a look at the issue directly)? Thanks in advance!
Hello again,
Turns out my workaround wasn’t really much of a workaround as it was just reversing the order of the posts, I still couldn’t re-order them by any other field.
I therefore had one of my programmer friends look into it for me and he came up with a solution, kind of over my head… but it’s fixed it nonetheless!
Just for the record, here is what he did:
<?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(); ?>
This is great…thanks for sharing it, pealo86. It should be of value to folks who experience the same issue down the road and we appreciate it.
As always, let us know if you need anything else. Thanks again for using The Events Calendar.