Display contextual options in event list widget

This commit is contained in:
Brian Miyaji
2016-12-19 21:11:42 +11:00
parent c7479d63ef
commit 97dccd95ac

View File

@@ -81,6 +81,8 @@ class SP_Widget_Event_List extends WP_Widget {
$order = strip_tags($instance['order']); $order = strip_tags($instance['order']);
$show_all_events_link = $instance['show_all_events_link']; $show_all_events_link = $instance['show_all_events_link'];
$time_format = get_option( 'sportspress_event_list_time_format', 'combined' );
// Action to hook into // Action to hook into
do_action( 'sportspress_before_widget_template_form', $this, $instance, 'event-list' ); do_action( 'sportspress_before_widget_template_form', $this, $instance, 'event-list' );
?> ?>
@@ -156,12 +158,27 @@ class SP_Widget_Event_List extends WP_Widget {
<p class="sp-prefs"> <p class="sp-prefs">
<?php _e( 'Columns:', 'sportspress' ); ?><br> <?php _e( 'Columns:', 'sportspress' ); ?><br>
<?php <?php
$the_columns = array( $the_columns = array();
'event' => __( 'Event', 'sportspress' ), $the_columns['event'] = __( 'Event', 'sportspress' );
'time' => __( 'Time/Results', 'sportspress' ),
'venue' => __( 'Venue', 'sportspress' ), if ( 'combined' === $time_format ) {
'article' => __( 'Article', 'sportspress' ),
); $the_columns['time'] = __( 'Time/Results', 'sportspress' );
} else {
if ( in_array( $time_format, array( 'time', 'separate' ) ) ) {
$the_columns['time'] = __( 'Time', 'sportspress' );
}
if ( in_array( $time_format, array( 'results', 'separate' ) ) ) {
$the_columns['results'] = __( 'Results', 'sportspress' );
}
}
$the_columns['venue'] = __( 'Venue', 'sportspress' );
$the_columns['article'] = __( 'Article', 'sportspress' );
$field_name = $this->get_field_name('columns') . '[]'; $field_name = $this->get_field_name('columns') . '[]';
$field_id = $this->get_field_id('columns'); $field_id = $this->get_field_id('columns');
?> ?>