Add argument to countdown widget function
This commit is contained in:
@@ -8,18 +8,10 @@ if ( !function_exists( 'sportspress_countdown' ) ) {
|
|||||||
if ( $id ):
|
if ( $id ):
|
||||||
$post = get_post( $id );
|
$post = get_post( $id );
|
||||||
else:
|
else:
|
||||||
$options = array(
|
$args = array();
|
||||||
'post_type' => 'sp_event',
|
|
||||||
'posts_per_page' => 1,
|
|
||||||
'order' => 'ASC',
|
|
||||||
'post_status' => 'future',
|
|
||||||
'meta_query' => array(),
|
|
||||||
);
|
|
||||||
if ( isset( $args['team'] ) )
|
if ( isset( $args['team'] ) )
|
||||||
$options['meta_query'][] = array( 'key' => 'sp_team', 'value' => $args['team'] );
|
$args = array( 'key' => 'sp_team', 'value' => $args['team'] );
|
||||||
|
$post = sportspress_get_next_event( $args );
|
||||||
$posts = get_posts( $options );
|
|
||||||
$post = array_pop( $posts );
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class SP_Widget_Countdown extends WP_Widget {
|
|||||||
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
|
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
|
||||||
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
|
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
|
||||||
|
|
||||||
<p><label for="<?php echo $this->get_field_id('event'); ?>"><?php _e( 'Select Event:', 'sportspress' ); ?></label>
|
<p><label for="<?php echo $this->get_field_id('event'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Event', 'sportspress' ) ); ?></label>
|
||||||
<?php
|
<?php
|
||||||
$args = array(
|
$args = array(
|
||||||
'post_type' => 'sp_event',
|
'post_type' => 'sp_event',
|
||||||
@@ -48,13 +48,13 @@ class SP_Widget_Countdown extends WP_Widget {
|
|||||||
'post_status' => 'future',
|
'post_status' => 'future',
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_pages( $args ) ):
|
if ( ! sportspress_dropdown_pages( $args ) ):
|
||||||
sportspress_post_adder( 'sp_event', __( 'Add New Event', 'sportspress' ) );
|
sportspress_post_adder( 'sp_event', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_league'); ?>" name="<?php echo $this->get_field_name('show_league'); ?>" value="1" <?php checked( $show_league, 1 ); ?>>
|
<p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_league'); ?>" name="<?php echo $this->get_field_name('show_league'); ?>" value="1" <?php checked( $show_league, 1 ); ?>>
|
||||||
<label for="<?php echo $this->get_field_id('show_league'); ?>"><?php _e( 'Display League', 'sportspress' ); ?></label></p>
|
<label for="<?php echo $this->get_field_id('show_league'); ?>"><?php _e( 'Display league', 'sportspress' ); ?></label></p>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user