Ordering Events in order of start date

Home Forums Calendar Products Events Calendar PRO Ordering Events in order of start date

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #736935
    Joanna Shebson
    Participant

    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!

    #737820
    Josh
    Participant

    Hello 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!

    #743119
    Joanna Shebson
    Participant

    Wow! 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!

    #744914
    Josh
    Participant

    Hello 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!

    #745921
    Joanna Shebson
    Participant

    This reply is private.

    #746421
    Joanna Shebson
    Participant

    Also, 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?

    #749657
    Josh
    Participant

    Hello 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!

    #907321
    Josh
    Participant

    Hello 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

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Ordering Events in order of start date’ is closed to new replies.