Home › Forums › Calendar Products › Events Calendar PRO › help issue
- This topic has 9 replies, 2 voices, and was last updated 6 years, 10 months ago by Mark Metz.
-
AuthorPosts
-
May 16, 2017 at 4:31 am #1284304Mark MetzParticipant
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.
May 17, 2017 at 2:52 am #1284817Mark MetzParticipanthere 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.
May 17, 2017 at 4:35 pm #1285223VictorKeymasterHi 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!
VictorMay 18, 2017 at 4:53 am #1285393Mark MetzParticipantits 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’) );
May 18, 2017 at 5:24 am #1285414VictorKeymasterHi 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,
VictorMay 18, 2017 at 5:40 am #1285420Mark MetzParticipantHi
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.May 18, 2017 at 10:13 am #1285757VictorKeymasterHi 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.
May 19, 2017 at 12:18 am #1286079Mark MetzParticipantthanks its works
May 19, 2017 at 4:53 am #1286175VictorKeymasterThat’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 -
AuthorPosts
- The topic ‘help issue’ is closed to new replies.