How to identify recurring events using tribe_is_event

Home Forums Calendar Products Events Calendar PRO How to identify recurring events using tribe_is_event

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #94782
    Kelly
    Participant

    Hey team. I’m trying to find a way to display if event is recurring and how many events there are that will recur. When a user searches the site, I’ve used the following code to let them know that it is an event:

    <?php if ( tribe_is_event () ) { echo ‘Event’; } ?>

    Can I use the same sort of logic to list recurring? In a perfect world, I’d like it to read something along the lines of “Event – 15 performances”

    Thanks for your help 🙂

    #95374
    Brook
    Participant

    Howdy dotwongdotcom,

    Detecting if an event is recurring is just as east. Simply use the function tribe_is_recurring_event().

    Detecting how many events are in a series is not going to be easy. Something like the following would probably work:
    $instances = get_post_meta( $event_id, '_EventRecurrence', true );
    count( $instances );

    But, you might have to fiddle with that to get it do what you need it to. That would include future and past events, and a few other caveats that may not help in your particular circumstance. In other words that exact code may not work, but I hope it helps get you started in the right direction.

    Let me know if you have other questions or if I can clarify anything. Thanks!

    – Brook

    #95710
    Kelly
    Participant

    Thanks again, Brook 🙂 That helps me get going. Cheers!

    #95778
    Brook
    Participant

    You are muey welcome.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘How to identify recurring events using tribe_is_event’ is closed to new replies.