Home › Forums › Calendar Products › Events Calendar PRO › Distinguish between blog post and calendar event
- This topic has 3 replies, 2 voices, and was last updated 9 years, 3 months ago by Geoff.
-
AuthorPosts
-
February 16, 2015 at 12:02 pm #942809NicolaParticipant
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,
NicolaFebruary 16, 2015 at 4:06 pm #942884GeoffMemberHello 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
February 16, 2015 at 5:09 pm #942893NicolaParticipantThank you, this works perfect!
February 17, 2015 at 7:09 am #943032GeoffMemberSweet! 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
-
AuthorPosts
- The topic ‘Distinguish between blog post and calendar event’ is closed to new replies.