Avoid Undefined index warnings if no status is set (i.e. during import)
This commit is contained in:
@@ -19,7 +19,7 @@ class SP_Widget_Countdown extends WP_Widget {
|
|||||||
$show_excluded = empty($instance['show_excluded']) ? false : $instance['show_excluded'];
|
$show_excluded = empty($instance['show_excluded']) ? false : $instance['show_excluded'];
|
||||||
$order = empty($instance['order']) ? false : $instance['order'];
|
$order = empty($instance['order']) ? false : $instance['order'];
|
||||||
$orderby = empty($instance['orderby']) ? false : $instance['orderby'];
|
$orderby = empty($instance['orderby']) ? false : $instance['orderby'];
|
||||||
$show_status = empty($instance['show_status']) ? true : $instance['show_status'];
|
$show_status = empty($instance['show_status']) ? false : $instance['show_status'];
|
||||||
|
|
||||||
do_action( 'sportspress_before_widget', $args, $instance, 'countdown' );
|
do_action( 'sportspress_before_widget', $args, $instance, 'countdown' );
|
||||||
echo $before_widget;
|
echo $before_widget;
|
||||||
|
|||||||
@@ -110,9 +110,10 @@ if ( $title )
|
|||||||
|
|
||||||
$title = $post->post_title;
|
$title = $post->post_title;
|
||||||
if ( $link_events ) $title = '<a href="' . get_post_permalink( $post->ID, false, true ) . '">' . $title . '</a>';
|
if ( $link_events ) $title = '<a href="' . get_post_permalink( $post->ID, false, true ) . '">' . $title . '</a>';
|
||||||
|
if ( isset( $show_status ) && $show_status ){
|
||||||
if ( $show_status ) {
|
|
||||||
$sp_status = get_post_meta($post->ID, 'sp_status', true);
|
$sp_status = get_post_meta($post->ID, 'sp_status', true);
|
||||||
|
//Avoid Undefined index warnings if no status is set (i.e. during import)
|
||||||
|
if ( $sp_status == '' ) $sp_status = 'ok';
|
||||||
$statuses = apply_filters( 'sportspress_event_statuses', array(
|
$statuses = apply_filters( 'sportspress_event_statuses', array(
|
||||||
'ok' => __( 'On time', 'sportspress' ),
|
'ok' => __( 'On time', 'sportspress' ),
|
||||||
'tbd' => __( 'TBD', 'sportspress' ),
|
'tbd' => __( 'TBD', 'sportspress' ),
|
||||||
|
|||||||
Reference in New Issue
Block a user