Created
May 4, 2018 20:04
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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