help issue

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1284304
    Mark Metz
    Participant

    here is my events query
    $events = tribe_get_events( array(
    ‘author’ => $id,
    ‘order’ => ‘DESC’,
    ‘orderby’ => ‘date’,

    ) );

    i want to show only future and recurring events please help me to change the query for the solution.

    #1284817
    Mark Metz
    Participant

    here is my events query
    $events = tribe_get_events( array(
    ‘author’ => $id,
    ‘order’ => ‘DESC’,
    ‘orderby’ => ‘date’,

    ) );

    i want to show only future and recurring events please help me to change the query for the solution.

    #1285223
    Victor
    Keymaster

    Hi Mark!

    Thanks for reaching out to us! I’m happy to help you with that. 🙂

    You can try using the ‘meta_key’ argument like the following:

    // Retrieve upcoming recurring events only
    $events = tribe_get_events( array(
    'eventDisplay' => 'list',
    'meta_key' => '_EventRecurrence'
    ) );

    This will only fetch upcoming recurrent events because they are the only events that will have an ‘_EventRecurrence’ meta key associated.

    I hope that helps and let me know if you have other questions.

    Cheers!
    Victor

    #1285393
    Mark Metz
    Participant

    its not working see that here old events still display https://consciousdancer.com/profile/claire-at-inbodied.com/
    $events = tribe_get_events( array(
    ‘author’ => $id,
    ‘order’ => ‘DESC’,
    ‘orderby’ => ‘date’,
    ‘eventDisplay’ => ‘list’,
    ‘meta_key’ => ‘_EventRecurrence’

    ) );

    #1285414
    Victor
    Keymaster

    Hi Mark!

    Thanks for coming back!

    You are using the ‘orderby’ => ‘date’ argument which will order events by date of creation and not by event start date. By only using ‘eventDisplay’ => ‘list’ argument you will already be fetching the upcoming events.

    Does it help? Let me know about it.

    Best,
    Victor

    #1285420
    Mark Metz
    Participant

    Hi
    Its still showing past events.I need to show events future events and recurring events as per user profile.
    the query you provide it does not solve my problem.

    #1285757
    Victor
    Keymaster

    Hi Mark!

    I tweaked it a little to make sure it works as expected:

    $events = tribe_get_events( array(
    'author' => $id,
    'order' => 'ASC',
    'meta_query' => array(
    array(
    'key' => '_EventStartDate',
    'value' => date( 'Y-m-d H:i:s' ),
    'type' => 'DATETIME',
    'compare' => '>',
    ),
    array(
    'key' => '_EventRecurrence',
    'compare' => 'EXISTS',
    ),
    ),
    ) );

    Let me know if that works now.

    #1286079
    Mark Metz
    Participant

    thanks its works

    #1286175
    Victor
    Keymaster

    That’s great! I’m glad it worked! Thanks for following up to let us know about it. 🙂

    I’ll close this thread now, but feel free to open a new one if any other question comes up.

    Best!
    Victor

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘help issue’ is closed to new replies.