Add option to display match day in event details

This commit is contained in:
Brian Miyaji
2016-09-01 22:03:10 +10:00
parent 28da7724b6
commit 1033aaf375
2 changed files with 113 additions and 91 deletions

View File

@@ -72,6 +72,7 @@ class SP_Settings_Events extends SP_Settings_Page {
'type' => 'checkbox', 'type' => 'checkbox',
'checkboxgroup' => 'start', 'checkboxgroup' => 'start',
), ),
array( array(
'desc' => __( 'Time', 'sportspress' ), 'desc' => __( 'Time', 'sportspress' ),
'id' => 'sportspress_event_show_time', 'id' => 'sportspress_event_show_time',
@@ -79,6 +80,14 @@ class SP_Settings_Events extends SP_Settings_Page {
'type' => 'checkbox', 'type' => 'checkbox',
'checkboxgroup' => '', 'checkboxgroup' => '',
), ),
array(
'desc' => __( 'Match Day', 'sportspress' ),
'id' => 'sportspress_event_show_day',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end',
),
) ), ) ),
array( array(
@@ -294,109 +303,115 @@ class SP_Settings_Events extends SP_Settings_Page {
array( 'title' => __( 'Box Score', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'performance_options' ), array( 'title' => __( 'Box Score', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'performance_options' ),
), ),
apply_filters( 'sportspress_performance_options', array( apply_filters( 'sportspress_performance_options', array_merge(
array( array(
'title' => __( 'Rows', 'sportspress' ), array(
'desc' => __( 'Staff', 'sportspress' ), 'title' => __( 'Rows', 'sportspress' ),
'id' => 'sportspress_event_show_staff', 'desc' => __( 'Staff', 'sportspress' ),
'default' => 'yes', 'id' => 'sportspress_event_show_staff',
'type' => 'checkbox', 'default' => 'yes',
'checkboxgroup' => 'start', 'type' => 'checkbox',
), 'checkboxgroup' => 'start',
),
array( array(
'desc' => __( 'Players', 'sportspress' ), 'desc' => __( 'Players', 'sportspress' ),
'id' => 'sportspress_event_show_players', 'id' => 'sportspress_event_show_players',
'default' => 'yes', 'default' => 'yes',
'type' => 'checkbox', 'type' => 'checkbox',
'checkboxgroup' => '', 'checkboxgroup' => '',
), ),
array( array(
'desc' => __( 'Total', 'sportspress' ), 'desc' => __( 'Total', 'sportspress' ),
'id' => 'sportspress_event_show_total', 'id' => 'sportspress_event_show_total',
'default' => 'yes', 'default' => 'yes',
'type' => 'checkbox', 'type' => 'checkbox',
'checkboxgroup' => 'end', 'checkboxgroup' => 'end',
), ),
array( array(
'title' => __( 'Columns', 'sportspress' ), 'title' => __( 'Columns', 'sportspress' ),
'id' => 'sportspress_event_performance_columns', 'id' => 'sportspress_event_performance_columns',
'default' => 'auto', 'default' => 'auto',
'type' => 'radio', 'type' => 'radio',
'options' => array( 'options' => array(
'auto' => __( 'Auto', 'sportspress' ), 'auto' => __( 'Auto', 'sportspress' ),
'manual' => __( 'Manual', 'sportspress' ), 'manual' => __( 'Manual', 'sportspress' ),
),
),
array(
'title' => __( 'Mode', 'sportspress' ),
'id' => 'sportspress_event_performance_mode',
'default' => 'values',
'type' => 'radio',
'options' => array(
'values' => __( 'Values', 'sportspress' ),
'icons' => __( 'Icons', 'sportspress' ),
),
),
array(
'title' => __( 'Positions', 'sportspress' ),
'desc' => __( 'Top-level only', 'sportspress' ),
'id' => 'sportspress_event_hide_child_positions',
'default' => 'no',
'type' => 'checkbox',
), ),
), ),
array( apply_filters( 'sportspress_event_performance_display_options', array(
'title' => __( 'Mode', 'sportspress' ), array(
'id' => 'sportspress_event_performance_mode', 'title' => __( 'Display', 'sportspress' ),
'default' => 'values', 'desc' => __( 'Squad Number', 'sportspress' ),
'type' => 'radio', 'id' => 'sportspress_event_show_player_numbers',
'options' => array( 'default' => 'yes',
'values' => __( 'Values', 'sportspress' ), 'type' => 'checkbox',
'icons' => __( 'Icons', 'sportspress' ), 'checkboxgroup' => 'start',
), ),
),
array( array(
'title' => __( 'Positions', 'sportspress' ), 'desc' => __( 'Position', 'sportspress' ),
'desc' => __( 'Top-level only', 'sportspress' ), 'id' => 'sportspress_event_show_position',
'id' => 'sportspress_event_hide_child_positions', 'default' => 'yes',
'default' => 'no', 'type' => 'checkbox',
'type' => 'checkbox', 'checkboxgroup' => '',
),
array(
'title' => __( 'Display', 'sportspress' ),
'desc' => __( 'Squad Number', 'sportspress' ),
'id' => 'sportspress_event_show_player_numbers',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
),
array(
'desc' => __( 'Position', 'sportspress' ),
'id' => 'sportspress_event_show_position',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => '',
),
array(
'desc' => __( 'Time', 'sportspress' ),
'id' => 'sportspress_event_performance_show_time',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end',
),
array(
'title' => __( 'Performance', 'sportspress' ),
'id' => 'sportspress_event_performance_sections',
'default' => -1,
'type' => 'radio',
'options' => array(
-1 => __( 'Combined', 'sportspress' ),
0 => __( 'Offense', 'sportspress' ) . ' → ' . __( 'Defense', 'sportspress' ),
1 => __( 'Defense', 'sportspress' ) . ' → ' . __( 'Offense', 'sportspress' ),
), ),
),
array(
'desc' => __( 'Time', 'sportspress' ),
'id' => 'sportspress_event_performance_show_time',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end',
),
) ),
array( array(
'title' => __( 'Total', 'sportspress' ), array(
'id' => 'sportspress_event_total_performance', 'title' => __( 'Performance', 'sportspress' ),
'default' => 'all', 'id' => 'sportspress_event_performance_sections',
'type' => 'radio', 'default' => -1,
'options' => array( 'type' => 'radio',
'all' => __( 'All', 'sportspress' ), 'options' => array(
'primary' => __( 'Primary', 'sportspress' ), -1 => __( 'Combined', 'sportspress' ),
0 => __( 'Offense', 'sportspress' ) . ' → ' . __( 'Defense', 'sportspress' ),
1 => __( 'Defense', 'sportspress' ) . ' → ' . __( 'Offense', 'sportspress' ),
),
), ),
),
array(
'title' => __( 'Total', 'sportspress' ),
'id' => 'sportspress_event_total_performance',
'default' => 'all',
'type' => 'radio',
'options' => array(
'all' => __( 'All', 'sportspress' ),
'primary' => __( 'Primary', 'sportspress' ),
),
),
)
) ), ) ),
array( array(

View File

@@ -38,6 +38,13 @@ foreach ( $taxonomies as $taxonomy => $post_type ):
endif; endif;
endforeach; endforeach;
if ( 'yes' === get_option( 'sportspress_event_show_day', 'yes' ) ) {
$day = get_post_meta( $id, 'sp_day', true );
if ( '' !== $day ) {
$data[ __( 'Match Day', 'sportspress' ) ] = $day;
}
}
$data = apply_filters( 'sportspress_event_details', $data, $id ); $data = apply_filters( 'sportspress_event_details', $data, $id );
if ( ! sizeof( $data ) ) return; if ( ! sizeof( $data ) ) return;