Skip to content

Instantly share code, notes, and snippets.

@wpmudev-sls
Created December 20, 2019 08:12
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 wpmudev-sls/66a45ab7eab6886ef4782b61626a6073 to your computer and use it in GitHub Desktop.
Save wpmudev-sls/66a45ab7eab6886ef4782b61626a6073 to your computer and use it in GitHub Desktop.
[Events +] - Fix events do not show
<?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