Displaying Next event date for a recurring event.

Home Forums Calendar Products Events Calendar PRO Displaying Next event date for a recurring event.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #992583
    Peter
    Participant

    Hello!

    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.

    #992817
    Josh
    Participant

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

    #993776
    Peter
    Participant

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

    #994149
    Josh
    Participant

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

    #994645
    Peter
    Participant

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

    #994708
    Josh
    Participant

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

    #994911
    Peter
    Participant

    Really 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.

    null

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

    #995007
    Josh
    Participant

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

    #995281
    Peter
    Participant

    Hey 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.


    null

    I have disabled most plugins and still the same result. What settings did you use for the ACF?

    #995345
    Josh
    Participant

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

    #999525
    Support Droid
    Keymaster

    This 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.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Displaying Next event date for a recurring event.’ is closed to new replies.