Home › Forums › Calendar Products › Events Calendar PRO › Ordering Events in order of start date
- This topic has 7 replies, 2 voices, and was last updated 9 years, 4 months ago by Josh.
-
AuthorPosts
-
September 10, 2014 at 11:12 pm #736935Joanna ShebsonParticipant
I am trying to run a custom query to show events in upcoming order but no matter how I adjust the query, the events show up in random order (possibly entry/publish date but I tried changing those dates and it didn’t help)
I saw similar posts in the forum, but still cannot get this to work 🙁
http://screencast.com/t/uhhCGTtlxnf
http://www.funinjerusalem.com/event/chocotalk/2014-09-14/
I tried orderedby => date but that doesn’t help
I tried order by meta key, didn’t help
I tried order ASC, didn’t help
Here’s the code:
$today = date(“Y-m-d”);
$fttd_args = array (
‘post_type’ => ‘tribe_events’,
‘posts_per_page’ => ‘3’,
‘featured’=>’yes’,
‘order’ => ‘DESC’,
‘post__not_in’ => array(get_the_ID()),
‘meta_query’ => array(
array(
‘key’ => ‘_EventStartDate’,
‘value’ => $today,
‘compare’ => ‘>=’,
)
)
);Thanks!
September 11, 2014 at 7:27 am #737820JoshParticipantHello funinjerusalem,
Thanks for reaching out to us!
There is some very helpful information within this thread that should help you to get the order of events changed for your custom query. The approach at the bottom, where you set the basic query ( post type and number ) like you have above and then set the order of events using the “pre_get_posts” filter should work.
Let me know if this helps.
Thanks!
September 14, 2014 at 1:39 am #743119Joanna ShebsonParticipantWow! That was fantastic! The only thing that isn’t working is making sure the query doesn’t include the current event that is displaying.
I tried adding: ‘post__not_in’ => array(get_the_ID()),
but it didn’t work. Any ideas? Thanks!September 15, 2014 at 10:18 am #744914JoshParticipantHello funinjerusalem,
Thanks for following up with us!
I’m happy the other tutorial was able to get you sorted out. For the other issue, try using the following approach for getting the current event’s ID for adding it to the “post__not_in” array.
global $post; $post->ID;
Let me know if this works for you.
Thanks!September 15, 2014 at 11:58 pm #745921Joanna ShebsonParticipantThis reply is private.
September 16, 2014 at 8:35 am #746421Joanna ShebsonParticipantAlso, if I put a recurring event in the Featured category, is there a way to get it to only show the first instance of the event?
September 17, 2014 at 6:43 pm #749657JoshParticipantHello funinjerusalem,
Thanks for following up!
You can try to see if the ID is getting pulled by assigning the “$post->ID” to a variable and echoing it onto the page. That’ll at least debug to see if the proper post ID is being grabbed. Unfortunately, beyond that, there isn’t much else I can do to help in getting customizations pulled together for sites.
For the recurring events issue, you could try using this setting within the “Settings” -> “General” tab of our plugin to see if this gets you the desired display that you’re looking for.
Let me know if this helps.
Thanks!
December 4, 2014 at 12:22 am #907321JoshParticipantHello funinjerusalem,
It’s been a while since we’ve heard from you. We like to close tickets after they’ve been inactive for a while. If you have any further questions, please don’t hesitate to open a new ticket.
Thanks!– Josh
-
AuthorPosts
- The topic ‘Ordering Events in order of start date’ is closed to new replies.