Distinguish between blog post and calendar event

Home Forums Calendar Products Events Calendar PRO Distinguish between blog post and calendar event

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #942809
    Nicola
    Participant

    Hello, thanks to Barry’s patience I got my first issue to work now and I am trying to learn the basics of php. Now I have another question.

    I do show calandar events in the main blog loop along with normal blog postings. For the normal blog postings I do want to show the date they were published, using

    <?php the_time(get_option('date_format')); ?>

    and for the calendar events I do want to show the date published and the event duration, using

    <?php echo tribe_events_event_schedule_details(); ?>

    From what I have learned from my previous support thread I can do that if I knew how to distinguish blog post from calendar event.

    Like this:

    <?php if ( <strong>is_a_tribe_event</strong>() ) ?>
    <?php echo tribe_events_event_schedule_details(); ?>
    <?php endif ?>

    Is there a tag for “is a tribe/calendar event”? Because I could not find one browsing the support section.

    Kind regards,
    Nicola

    #942884
    Geoff
    Member

    Hello Nicola! Thanks for reaching out and for the kind words–I’ll be sure Barry knows he rocks. πŸ™‚

    Good question and–believe it or note–you’re pretty close.

    You can do a check for whether a post is an event using theΒ tribe_is_event() function. So, that might look something like this:

    <?php if ( tribe_is_event() ) {
    echo tribe_events_event_schedule_details();
    } ?>

    See, pretty close! Nice work.

    Does this help? Please let me know. πŸ™‚

    Geoff

     

    #942893
    Nicola
    Participant

    Thank you, this works perfect!

    #943032
    Geoff
    Member

    Sweet! Thanks for following up and letting me know. πŸ™‚

    I’ll go ahead and close this thread, but please feel free to reach back out if any other questions pop up–we’d be happy to help.

    Geoff

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Distinguish between blog post and calendar event’ is closed to new replies.