Skip to content

Instantly share code, notes, and snippets.

@barryhughes
Created May 4, 2018 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barryhughes/02be595a05483c4c0a03b2a9bb1cd363 to your computer and use it in GitHub Desktop.
Save barryhughes/02be595a05483c4c0a03b2a9bb1cd363 to your computer and use it in GitHub Desktop.
Allows the list of events below the mini calendar widget to include events from future months, if there are none (or not enough) in the current month
<?php
function remove_mini_cal_list_end_date( $query ) {
remove_action( 'tribe_events_pre_get_posts', 'remove_mini_cal_list_end_date' );
$query->set( 'end_date', '' );
}
function listen_for_mini_cal_list( $template_file ) {
if ( basename( dirname( $template_file ) ) . '/' . basename( $template_file ) == 'mini-calendar/list.php' ) {
add_action( 'tribe_events_pre_get_posts', 'remove_mini_cal_list_end_date' );
}
}
// Remove this wrapper if you want this behaviour even after pagination
if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
add_action( 'tribe_before_get_template_part', 'listen_for_mini_cal_list' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment