tribe_venue_upcoming_events( bool|int $post_id = false, $args = array() )
Output the upcoming events associated with a venue.
Contents
Parameters
- $post_id
-
(bool|int) (Optional) The Venue post ID.
Default value: false
- $wp_query
-
(array) (Required) An array of arguments to override the default ones.
Return
(null|string) Null if the specified venue does not exist, the upcoming events HTML otherwise.
Source
File: src/functions/template-tags/venue.php
function tribe_venue_upcoming_events( $post_id = false, array $args = array() ) {
$page = ! empty( $args['page'] ) ? $args['page'] : 1;
$post_id = Tribe__Events__Main::postIdHelper( $post_id );
/**
* Allow for cusotmizing the number of events that show on each single-venue page.
*
* @since 4.4.16
*
* @param int $posts_per_page The number of events to show.
*/
$events_per_page = apply_filters( 'tribe_events_single_venue_posts_per_page', 100 );
/** @var Tribe__Context $context */
$context = tribe('context');
$display = $context->get( 'event_display' );
$date_pivot_key = 'past' === $display ? 'starts_before' : 'starts_after';
if ( $post_id ) {
$args = array(
'venue' => $post_id,
'eventDisplay' => tribe_get_request_var( 'tribe_event_display', 'list' ),
'posts_per_page' => $events_per_page,
'paged' => $page,
$date_pivot_key => 'now',
);
$html = tribe_include_view_list( $args );
/**
* Allows for customizing the markup of the list of events on single-venue pages.
*
* @since 4.4.16
*
* @param string $html The markup of events retrieved for the single-venue page.
*/
return apply_filters( 'tribe_venue_upcoming_events', $html );
}
return null;
}