Home › Forums › Calendar Products › Events Calendar PRO › help issue
- This topic has 9 replies, 2 voices, and was last updated 8 years, 11 months ago by
Mark Metz.
-
AuthorPosts
-
May 16, 2017 at 4:31 am #1284304
Mark Metz
Participanthere 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 Metz
Participanthere 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 #1285223Victor
MemberHi 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 Metz
Participantits 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 #1285414Victor
MemberHi 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 Metz
ParticipantHi
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 #1285757Victor
MemberHi 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 Metz
Participantthanks its works
May 19, 2017 at 4:53 am #1286175Victor
MemberThat’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.
