Created
December 20, 2019 08:12
-
-
Save wpmudev-sls/66a45ab7eab6886ef4782b61626a6073 to your computer and use it in GitHub Desktop.
[Events +] - Fix events do not show
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 | |
/** | |
* Plugin Name: [Events +] - Fix events do not show | |
* Plugin URI: https://premium.wpmudev.org/ | |
* Author: Thobk @ WPMUDEV | |
* Author URI: https://premium.wpmudev.org | |
* License: GPLv2 or later | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
add_action( 'after_setup_theme', 'wpmudev_eba_fix_events_do_not_show_func', 100 ); | |
function wpmudev_eba_fix_events_do_not_show_func(){ | |
if( class_exists('Eab_EventsHub') ){ | |
add_filter( 'eab-collection/hide_old', 'wpmudev_eba_fix_events_do_not_show'); | |
function wpmudev_eba_fix_events_do_not_show($hide_old){ | |
if( isset( $_GET['date'] ) ){ | |
$date = strtotime( $_GET['date'] ); | |
if( $date && $date > time() ){ | |
$hide_old = false; | |
} | |
}else{ | |
$year = get_query_var( 'event_year' ); | |
$month = get_query_var( 'event_monthnum' ); | |
if( $year && $month && strtotime("$year-$month-01") > time() ){ | |
$hide_old = false; | |
} | |
} | |
return $hide_old; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment