Home › Forums › Calendar Products › Events Calendar PRO › Get Upcoming Date of Single Recurring Event
- This topic has 3 replies, 2 voices, and was last updated 10 years, 6 months ago by
George.
-
AuthorPosts
-
October 26, 2015 at 9:09 am #1017946
Our Saviors Church
ParticipantI’m trying to list just the date of a specific event on a page template, but I can’t quite figure out how. If I could get the event by ID, that would be great, or I could isolate it using the tag AND category. I’ve tried following along from this article to using the tag like so:
// Ensure the global $post variable is in scope global $post; // Retrieve the next 5 upcoming events $events = tribe_get_events( array( 'eventDisplay' => 'upcoming', 'posts_per_page' => 1, 'tax_query'=> array( 'taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => 'lafayette' ), 'tag' => 'Step One' ) ); foreach ( $events as $post ) { setup_postdata( $post ); echo tribe_get_start_date(); }But that’s not working, it’s not returning any results. I’ve tried it with and without the tax_query line setting the category. Any advice on a good way to do this? Again, just need the next upcoming date for a specific recurring event.
-
This topic was modified 10 years, 6 months ago by
Our Saviors Church.
-
This topic was modified 10 years, 6 months ago by
Our Saviors Church.
October 26, 2015 at 9:43 am #1017982Our Saviors Church
ParticipantI think I fixed it myself, but I’d love to verify with someone that this is the best way to do this.
<?php global $post; $events = tribe_get_events( array( 'eventDisplay' => 'upcoming', 'posts_per_page' => 1, 'tribe_events_cat' => 'lafayette', 'tag' => 'step-one' ) ); foreach ( $events as $post ) { setup_postdata( $post ); echo tribe_get_start_date($event, '', 'F j'); } ?>-
This reply was modified 10 years, 6 months ago by
Our Saviors Church.
October 26, 2015 at 10:32 am #1018004George
ParticipantI’m sorry @Tyler, but we cannot offer any support with custom code here 🙁
I will close this ticket for now – if your second code example works well for you, keep using that!
Sincerely,
GeorgeOctober 26, 2015 at 10:35 am #1018006George
ParticipantP.S.
For what it’s worth, just to help a little bit here, your second solution is correct. I would personally recommend this instead to reduce chance of conflict with the unnecessary loading of the $post global:
<?php$events = tribe_get_events( array(
'eventDisplay'=> 'upcoming',
'posts_per_page' => 1,
'tribe_events_cat' => 'lafayette',
'tag' => 'step-one'
) );foreach ( $events as $event ) {
echo tribe_get_start_date( $event, '', 'F j' );
}
?>
-
This topic was modified 10 years, 6 months ago by
-
AuthorPosts
- The topic ‘Get Upcoming Date of Single Recurring Event’ is closed to new replies.
