Home › Forums › Calendar Products › Events Calendar PRO › Displaying Next event date for a recurring event.
- This topic has 10 replies, 3 voices, and was last updated 10 years, 8 months ago by
Support Droid.
-
AuthorPosts
-
August 2, 2015 at 7:49 pm #992583
Peter
ParticipantHello!
I have a custom theme that allows the user to select an event to feature on the home page. This is using the events ID and standard WordPress post data setup.
The issue I am having is that using tribe_events_event_schedule_details(); to display the events details is the date for the last event in the series not the next event.
ie an event that runs each month till the end of the year is only showing its November date.
This is displayed at the bottom of the home page.
Thanks.
August 3, 2015 at 11:23 am #992817Josh
ParticipantHey Peter,
Thanks for reaching out to us!
For the recurring event, you could use a “tribe_get_events” loop to target your desired event for the homepage and use the ” tribeHideRecurrence’ => 1 ” argument to grab just the next upcoming event in the recurring series.
Alternatively, you could grab the ID for the next event in the recurrence. When looking at the events within the dashboard, you will see an “Edit All” as well as an “Edit Single” event. If you hover over the “Edit Single” option you’ll see that each event within a recurring event series has it’s own ID. You can use that ID to get the single instance that you would like.
Let me know if this helps.
Thanks!
August 5, 2015 at 10:34 pm #993776Peter
ParticipantHello Josh,
Thanks for the help, got a lot closer than before. Using the tribe_get_events() function I can get the next upcoming event fine but not to sure how to use that same function to target a specific reacuring event.
Using
$events = tribe_get_events( array(
‘p’ => $post_id,
‘posts_per_page’ => 1,
‘tribeHideRecurrence’ => 1,
‘start_date’ => new DateTime()
) );I get the right event but still only displaying the final date in the series. As I am using ACF to select the post ID I can only see the single event not individual events.
On a side note, using the startdate new datetime I get “strtotime() expects parameter 1 to be string, object given”
using that from this tuteAugust 7, 2015 at 5:12 am #994149Josh
ParticipantHey Peter,
Thanks for following up!
Out of curiosity, when getting that $post_id from the ACF field, can you take that and compare the ID to the recurring event? From the main “Events” view within your dashboard, hover over the last event within the recurring series does the post ID being selected by ACF match the “Edit All” post ID or does it match the “Edit Single” post ID?
Thanks!
August 9, 2015 at 10:07 pm #994645Peter
ParticipantIn the back end when selecting a which post (event) to display you are only able to see a single occurrence of a re-occurring event but when I echo out that value its serving the id of the final event in the series not the “global” id. Hope that makes sense!
August 10, 2015 at 6:55 am #994708Josh
ParticipantHey Peter,
Thanks for following up!
It sounds like the issue here then isn’t the frontend output of the event but rather within the selection. If the selection within the dashboard is being assigned the ID of the last event within the series, it will display that last event rather than the recurrence.
I am a bit limited in the support that I am able to provide for customizations such as this but being an ACF user myself as well, I’m happy to take a look at a screenshot of how you have the post selection built and I can see if there is a better way so it’ll grab the global recurring event rather than single instance IDs.
Thanks!
August 10, 2015 at 6:47 pm #994911Peter
ParticipantReally appreciate the help Josh I realise it is out of the scope of events calendar.
Here is a screen shot of the ACF field and a code block from where its being displayed. If the field is page link then I have the option to select each of the occurrences but it would be ideal to get just the parent ID of the event set.

$post_id = get_field( 'event' ); echo $post_id; $events = tribe_get_events( array( 'p' => $post_id, 'posts_per_page' => 1, 'tribeHideRecurrence' => 1, 'start_date' => new DateTime() ) ); foreach ( $events as $post ): setup_postdata( $post ); ?>Thanks again Josh!
August 11, 2015 at 6:30 am #995007Josh
ParticipantHey Peter,
Thanks for adding the screenshot!
I tested pulling a post object and when I go to select the event using the field added to the page edit screen, I’m able to see the main recurring event as well as all instances of the recurrence in the dropdown (https://cloudup.com/cR25KCXL7m9). If I select the first one (non-indented one) it will output the main ID for the recurring event. If I select one of the others, it will give me the ID for that single instance of the recurring event.
Do you not have the same options when looking at the events dropdown?
Thanks!
August 11, 2015 at 7:33 pm #995281Peter
ParticipantHey Josh.
That would be good if I could get a list like that, all that comes up for this site is a single envent. First image is what shows up when editing the page the ACF field is on, the second is the list of events in Events Calendar.


I have disabled most plugins and still the same result. What settings did you use for the ACF?
August 12, 2015 at 6:23 am #995345Josh
ParticipantHey Peter,
That’s definitely strange. Here are the settings that I have for that field https://cloudup.com/cfV6B0KZXUS.
Comparing to your original screenshot, it looks like you may have ACF Pro activated? Out of curiosity, I wonder if you deactivate ACF Pro temporarily if the options would be different in that dropdown?
Thanks!
August 27, 2015 at 7:05 am #999525Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Displaying Next event date for a recurring event.’ is closed to new replies.
