Display all event performance columns by default

This commit is contained in:
Brian Miyaji
2014-08-26 02:16:10 +10:00
parent 1038b2f2a1
commit 04b1d7e520
3 changed files with 12 additions and 12 deletions

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy * @author ThemeBoy
* @category Admin * @category Admin
* @package SportsPress/Admin/Meta_Boxes * @package SportsPress/Admin/Meta_Boxes
* @version 1.1 * @version 1.3
*/ */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -64,7 +64,7 @@ class SP_Meta_Box_Event_Performance {
<th> <th>
<?php if ( $has_checkboxes ): ?> <?php if ( $has_checkboxes ): ?>
<label for="sp_columns_position"> <label for="sp_columns_position">
<input type="checkbox" name="sp_columns[]" value="position" id="sp_columns_position" <?php checked( is_array( $columns ) && in_array( 'position', $columns ) ); ?>> <input type="checkbox" name="sp_columns[]" value="position" id="sp_columns_position" <?php checked( ! is_array( $columns ) || in_array( 'position', $columns ) ); ?>>
<?php _e( 'Position', 'sportspress' ); ?> <?php _e( 'Position', 'sportspress' ); ?>
</label> </label>
<?php else: ?> <?php else: ?>

View File

@@ -5,7 +5,7 @@
* The SportsPress event class handles individual event data. * The SportsPress event class handles individual event data.
* *
* @class SP_Event * @class SP_Event
* @version 1.2.3 * @version 1.3
* @package SportsPress/Classes * @package SportsPress/Classes
* @category Class * @category Class
* @author ThemeBoy * @author ThemeBoy
@@ -98,13 +98,13 @@ class SP_Event extends SP_Custom_Post{
else: else:
// Add position to performance labels // Add position to performance labels
$labels = array_merge( array( 'position' => __( 'Position', 'sportspress' ) ), $labels ); $labels = array_merge( array( 'position' => __( 'Position', 'sportspress' ) ), $labels );
if ( ! is_array( $columns ) ) if ( is_array( $columns ) ):
$columns = array(); foreach ( $labels as $key => $label ):
foreach ( $labels as $key => $label ): if ( ! in_array( $key, $columns ) ):
if ( ! in_array( $key, $columns ) ): unset( $labels[ $key ] );
unset( $labels[ $key ] ); endif;
endif; endforeach;
endforeach; endif;
$performance[0] = $labels; $performance[0] = $labels;
return $performance; return $performance;
endif; endif;

View File

@@ -129,7 +129,7 @@ if ( is_array( $teams ) ):
echo '<td class="data-name">' . $name . '</td>'; echo '<td class="data-name">' . $name . '</td>';
if ( $mode == 'icons' ); echo '<td class="sp-performance-icons">'; if ( $mode == 'icons' ) echo '<td class="sp-performance-icons">';
foreach( $labels as $key => $label ): foreach( $labels as $key => $label ):
if ( $key == 'name' ) if ( $key == 'name' )
@@ -162,7 +162,7 @@ if ( is_array( $teams ) ):
endif; endif;
endforeach; endforeach;
if ( $mode == 'icons' ); echo '</td>'; if ( $mode == 'icons' ) echo '</td>';
echo '</tr>'; echo '</tr>';