Fix event list widget error
This commit is contained in:
@@ -1638,62 +1638,68 @@ if ( !function_exists( 'sp_get_calendar_data' ) ) {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( $pagenow != 'post-new.php' && $post_id ):
|
if ( $pagenow != 'post-new.php' ):
|
||||||
$leagues = get_the_terms( $post_id, 'sp_league' );
|
if ( $post_id ):
|
||||||
$seasons = get_the_terms( $post_id, 'sp_season' );
|
$leagues = get_the_terms( $post_id, 'sp_league' );
|
||||||
$venues = get_the_terms( $post_id, 'sp_venue' );
|
$seasons = get_the_terms( $post_id, 'sp_season' );
|
||||||
$team = get_post_meta( $post_id, 'sp_team', true );
|
$venues = get_the_terms( $post_id, 'sp_venue' );
|
||||||
$usecolumns = get_post_meta( $post_id, 'sp_columns', true );
|
$team = get_post_meta( $post_id, 'sp_team', true );
|
||||||
|
$usecolumns = get_post_meta( $post_id, 'sp_columns', true );
|
||||||
|
|
||||||
if ( $leagues ):
|
if ( $leagues ):
|
||||||
$league_ids = array();
|
$league_ids = array();
|
||||||
foreach( $leagues as $league ):
|
foreach( $leagues as $league ):
|
||||||
$league_ids[] = $league->term_id;
|
$league_ids[] = $league->term_id;
|
||||||
endforeach;
|
endforeach;
|
||||||
$args['tax_query'][] = array(
|
$args['tax_query'][] = array(
|
||||||
'taxonomy' => 'sp_league',
|
'taxonomy' => 'sp_league',
|
||||||
'field' => 'id',
|
'field' => 'id',
|
||||||
'terms' => $league_ids
|
'terms' => $league_ids
|
||||||
);
|
);
|
||||||
|
endif;
|
||||||
|
|
||||||
|
if ( $seasons ):
|
||||||
|
$season_ids = array();
|
||||||
|
foreach( $seasons as $season ):
|
||||||
|
$season_ids[] = $season->term_id;
|
||||||
|
endforeach;
|
||||||
|
$args['tax_query'][] = array(
|
||||||
|
'taxonomy' => 'sp_season',
|
||||||
|
'field' => 'id',
|
||||||
|
'terms' => $season_ids
|
||||||
|
);
|
||||||
|
endif;
|
||||||
|
|
||||||
|
if ( $venues ):
|
||||||
|
$venue_ids = array();
|
||||||
|
foreach( $venues as $venue ):
|
||||||
|
$venue_ids[] = $venue->term_id;
|
||||||
|
endforeach;
|
||||||
|
$args['tax_query'][] = array(
|
||||||
|
'taxonomy' => 'sp_venue',
|
||||||
|
'field' => 'id',
|
||||||
|
'terms' => $venue_ids
|
||||||
|
);
|
||||||
|
endif;
|
||||||
|
|
||||||
|
if ( $team ):
|
||||||
|
$args['meta_query'] = array(
|
||||||
|
array(
|
||||||
|
'key' => 'sp_team',
|
||||||
|
'value' => $team,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
endif;
|
||||||
|
|
||||||
|
else:
|
||||||
|
$usecolumns = null;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ( $seasons ):
|
|
||||||
$season_ids = array();
|
|
||||||
foreach( $seasons as $season ):
|
|
||||||
$season_ids[] = $season->term_id;
|
|
||||||
endforeach;
|
|
||||||
$args['tax_query'][] = array(
|
|
||||||
'taxonomy' => 'sp_season',
|
|
||||||
'field' => 'id',
|
|
||||||
'terms' => $season_ids
|
|
||||||
);
|
|
||||||
endif;
|
|
||||||
|
|
||||||
if ( $venues ):
|
|
||||||
$venue_ids = array();
|
|
||||||
foreach( $venues as $venue ):
|
|
||||||
$venue_ids[] = $venue->term_id;
|
|
||||||
endforeach;
|
|
||||||
$args['tax_query'][] = array(
|
|
||||||
'taxonomy' => 'sp_venue',
|
|
||||||
'field' => 'id',
|
|
||||||
'terms' => $venue_ids
|
|
||||||
);
|
|
||||||
endif;
|
|
||||||
|
|
||||||
if ( $team ):
|
|
||||||
$args['meta_query'] = array(
|
|
||||||
array(
|
|
||||||
'key' => 'sp_team',
|
|
||||||
'value' => $team,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
endif;
|
|
||||||
|
|
||||||
$events = get_posts( $args );
|
$events = get_posts( $args );
|
||||||
|
|
||||||
else:
|
else:
|
||||||
$usecolumns = null;
|
$usecolumns = null;
|
||||||
$events = null;
|
$events = array();
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ( $admin ):
|
if ( $admin ):
|
||||||
|
|||||||
Reference in New Issue
Block a user