Add option to show and hide players in events
This commit is contained in:
@@ -90,11 +90,20 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Player Performance', 'sportspress' ),
|
'title' => __( 'Players', 'sportspress' ),
|
||||||
|
'desc' => __( 'Display players', 'sportspress' ),
|
||||||
|
'id' => 'sportspress_event_show_players',
|
||||||
|
'default' => 'yes',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'checkboxgroup' => 'start',
|
||||||
|
),
|
||||||
|
|
||||||
|
array(
|
||||||
'desc' => __( 'Link players', 'sportspress' ),
|
'desc' => __( 'Link players', 'sportspress' ),
|
||||||
'id' => 'sportspress_event_link_players',
|
'id' => 'sportspress_event_link_players',
|
||||||
'default' => 'yes',
|
'default' => 'yes',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
|
'checkboxgroup' => 'end',
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ $performance = array_filter( $performance );
|
|||||||
$teams = (array)get_post_meta( $id, 'sp_team', false );
|
$teams = (array)get_post_meta( $id, 'sp_team', false );
|
||||||
$status = $event->status();
|
$status = $event->status();
|
||||||
|
|
||||||
|
$show_players = get_option( 'sportspress_event_show_players', 'yes' ) == 'yes' ? true : false;
|
||||||
$link_posts = get_option( 'sportspress_event_link_players', 'yes' ) == 'yes' ? true : false;
|
$link_posts = get_option( 'sportspress_event_link_players', 'yes' ) == 'yes' ? true : false;
|
||||||
$sortable = get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false;
|
$sortable = get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false;
|
||||||
$responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false;
|
$responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false;
|
||||||
@@ -61,7 +62,7 @@ foreach( $teams as $index => $team_id ):
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<?php if ( $has_players ): ?>
|
<?php if ( $show_players && $has_players ): ?>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -143,7 +144,7 @@ foreach( $teams as $index => $team_id ):
|
|||||||
</tbody>
|
</tbody>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ( $status == 'results' && array_key_exists( 0, $data ) ): ?>
|
<?php if ( $status == 'results' && array_key_exists( 0, $data ) ): ?>
|
||||||
<<?php echo ( $has_players ? 'tfoot' : 'tbody' ); ?>>
|
<<?php echo ( $show_players && $has_players ? 'tfoot' : 'tbody' ); ?>>
|
||||||
<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">
|
<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">
|
||||||
<?php
|
<?php
|
||||||
if ( $has_players ):
|
if ( $has_players ):
|
||||||
@@ -154,10 +155,11 @@ foreach( $teams as $index => $team_id ):
|
|||||||
$row = $data[0];
|
$row = $data[0];
|
||||||
|
|
||||||
foreach( $labels as $key => $label ):
|
foreach( $labels as $key => $label ):
|
||||||
if ( $key == 'name' ):
|
if ( $key == 'name' )
|
||||||
continue;
|
continue;
|
||||||
endif;
|
if ( $key == 'position' ):
|
||||||
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
|
$value = '—';
|
||||||
|
elseif ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
|
||||||
$value = $row[ $key ];
|
$value = $row[ $key ];
|
||||||
else:
|
else:
|
||||||
$value = sp_array_value( $totals, $key, 0 );
|
$value = sp_array_value( $totals, $key, 0 );
|
||||||
|
|||||||
Reference in New Issue
Block a user