Clean up config settings page tables

This commit is contained in:
Brian Miyaji
2014-01-04 13:19:42 +11:00
parent b5263009c1
commit 6cf7e5b77e
11 changed files with 55 additions and 25 deletions

View File

@@ -25,7 +25,6 @@ function sp_column_edit_columns() {
'title' => __( 'Label', 'sportspress' ), 'title' => __( 'Label', 'sportspress' ),
'sp_equation' => __( 'Equation', 'sportspress' ), 'sp_equation' => __( 'Equation', 'sportspress' ),
'sp_order' => __( 'Sort Order', 'sportspress' ), 'sp_order' => __( 'Sort Order', 'sportspress' ),
'sp_key' => __( 'Key', 'sportspress' ),
'sp_abbreviation' => __( 'Abbreviation', 'sportspress' ) 'sp_abbreviation' => __( 'Abbreviation', 'sportspress' )
); );
return $columns; return $columns;

View File

@@ -24,7 +24,7 @@ function sp_statistic_edit_columns() {
'cb' => '<input type="checkbox" />', 'cb' => '<input type="checkbox" />',
'title' => __( 'Label', 'sportspress' ), 'title' => __( 'Label', 'sportspress' ),
'sp_equation' => __( 'Equation', 'sportspress' ), 'sp_equation' => __( 'Equation', 'sportspress' ),
'sp_key' => __( 'Key', 'sportspress' ), 'sp_order' => __( 'Sort Order', 'sportspress' ),
'sp_abbreviation' => __( 'Abbreviation', 'sportspress' ) 'sp_abbreviation' => __( 'Abbreviation', 'sportspress' )
); );
return $columns; return $columns;

View File

@@ -15,6 +15,7 @@
<th><?php _e( 'Label', 'sportspress' ); ?></th> <th><?php _e( 'Label', 'sportspress' ); ?></th>
<th><?php _e( 'Equation', 'sportspress' ); ?></th> <th><?php _e( 'Equation', 'sportspress' ); ?></th>
<th><?php _e( 'Sort Order', 'sportspress' ); ?></th> <th><?php _e( 'Sort Order', 'sportspress' ); ?></th>
<th><?php _e( 'Abbreviation', 'sportspress' ); ?></th>
</tr> </tr>
</thead> </thead>
<?php $i = 0; foreach ( $data as $row ): ?> <?php $i = 0; foreach ( $data as $row ): ?>
@@ -48,11 +49,21 @@
endif; endif;
?> ?>
</td> </td>
<td>
<?php
$abbreviation = get_post_meta ( $row->ID, 'sp_abbreviation', true );
if ( $abbreviation ):
echo $abbreviation;
else:
echo $row->post_title;
endif;
?>
</td>
</tr> </tr>
<?php $i++; endforeach; ?> <?php $i++; endforeach; ?>
<tfoot> <tfoot>
<tr> <tr>
<th colspan="3"><a href="<?php echo admin_url( 'edit.php?post_type=sp_column' ); ?>"><?php printf( __( 'Edit %s', 'sportspress' ), __( 'Table Columns', 'sportspress' ) ); ?></a></th> <th colspan="4"><a href="<?php echo admin_url( 'edit.php?post_type=sp_column' ); ?>"><?php printf( __( 'Edit %s', 'sportspress' ), __( 'Table Columns', 'sportspress' ) ); ?></a></th>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
@@ -74,6 +85,7 @@
<th><?php _e( 'Label', 'sportspress' ); ?></th> <th><?php _e( 'Label', 'sportspress' ); ?></th>
<th><?php _e( 'Equation', 'sportspress' ); ?></th> <th><?php _e( 'Equation', 'sportspress' ); ?></th>
<th><?php _e( 'Sort Order', 'sportspress' ); ?></th> <th><?php _e( 'Sort Order', 'sportspress' ); ?></th>
<th><?php _e( 'Abbreviation', 'sportspress' ); ?></th>
</tr> </tr>
</thead> </thead>
<?php $i = 0; foreach ( $data as $row ): ?> <?php $i = 0; foreach ( $data as $row ): ?>
@@ -107,11 +119,21 @@
endif; endif;
?> ?>
</td> </td>
<td>
<?php
$abbreviation = get_post_meta ( $row->ID, 'sp_abbreviation', true );
if ( $abbreviation ):
echo $abbreviation;
else:
echo $row->post_title;
endif;
?>
</td>
</tr> </tr>
<?php $i++; endforeach; ?> <?php $i++; endforeach; ?>
<tfoot> <tfoot>
<tr> <tr>
<th colspan="3"><a href="<?php echo admin_url( 'edit.php?post_type=sp_column' ); ?>"><?php printf( __( 'Edit %s', 'sportspress' ), __( 'Statistics', 'sportspress' ) ); ?></a></th> <th colspan="4"><a href="<?php echo admin_url( 'edit.php?post_type=sp_statistic' ); ?>"><?php printf( __( 'Edit %s', 'sportspress' ), __( 'Statistics', 'sportspress' ) ); ?></a></th>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>

21
presets/presets.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
$sportspress_sports = array();
include_once dirname( __FILE__ ) . '/soccer.php';
include_once dirname( __FILE__ ) . '/football.php';
include_once dirname( __FILE__ ) . '/footy.php';
include_once dirname( __FILE__ ) . '/baseball.php';
include_once dirname( __FILE__ ) . '/basketball.php';
include_once dirname( __FILE__ ) . '/gaming.php';
include_once dirname( __FILE__ ) . '/cricket.php';
include_once dirname( __FILE__ ) . '/golf.php';
include_once dirname( __FILE__ ) . '/handball.php';
include_once dirname( __FILE__ ) . '/hockey.php';
include_once dirname( __FILE__ ) . '/racing.php';
include_once dirname( __FILE__ ) . '/rugby.php';
include_once dirname( __FILE__ ) . '/swimming.php';
include_once dirname( __FILE__ ) . '/tennis.php';
include_once dirname( __FILE__ ) . '/volleyball.php';
$sportspress_sports[] = array( 'name' => __( 'Custom', 'sportspress' ), 'posts' => array() );
?>

View File

@@ -133,7 +133,7 @@ add_action( 'manage_posts_columns', 'sp_manage_posts_columns' );
function sp_restrict_manage_posts() { function sp_restrict_manage_posts() {
sp_highlight_admin_menu(); sp_highlight_admin_menu();
global $typenow, $wp_query; global $typenow, $wp_query;
if ( in_array( $typenow, array( 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_list', 'sp_tournament' ) ) ): if ( in_array( $typenow, array( 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_list' ) ) ):
$selected = isset( $_REQUEST['sp_team'] ) ? $_REQUEST['sp_team'] : null; $selected = isset( $_REQUEST['sp_team'] ) ? $_REQUEST['sp_team'] : null;
$args = array( $args = array(
'show_option_none' => sprintf( __( 'All %s', 'sportspress' ), __( 'Teams', 'sportspress' ) ), 'show_option_none' => sprintf( __( 'All %s', 'sportspress' ), __( 'Teams', 'sportspress' ) ),
@@ -143,7 +143,7 @@ function sp_restrict_manage_posts() {
); );
// wp_dropdown_pages( $args ); // wp_dropdown_pages( $args );
endif; endif;
if ( in_array( $typenow, array( 'sp_player', 'sp_staff' ) ) ): if ( in_array( $typenow, array( 'sp_player' ) ) ):
$selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null; $selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null;
$args = array( $args = array(
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ), 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ),

View File

@@ -121,6 +121,9 @@ function sp_pre_get_posts( $wp_query ) {
if ( in_array( $post_type, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_statistic' ) ) ): if ( in_array( $post_type, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_statistic' ) ) ):
$wp_query->set( 'orderby', 'menu_order' ); $wp_query->set( 'orderby', 'menu_order' );
$wp_query->set( 'order', 'ASC' ); $wp_query->set( 'order', 'ASC' );
elseif ( $post_type == 'sp_event' ):
$wp_query->set( 'orderby', 'post_date' );
$wp_query->set( 'order', 'ASC' );
endif; endif;
endif; endif;
} }

View File

@@ -1348,7 +1348,6 @@ if ( !function_exists( 'sp_get_list_html' ) ) {
} }
} }
if ( !function_exists( 'sp_highlight_admin_menu' ) ) { if ( !function_exists( 'sp_highlight_admin_menu' ) ) {
function sp_highlight_admin_menu() { function sp_highlight_admin_menu() {
global $parent_file, $submenu_file; global $parent_file, $submenu_file;

View File

@@ -1,21 +1,4 @@
<?php <?php
$sportspress_sports = array();
include_once dirname( __FILE__ ) . '/presets/soccer.php';
include_once dirname( __FILE__ ) . '/presets/football.php';
include_once dirname( __FILE__ ) . '/presets/footy.php';
include_once dirname( __FILE__ ) . '/presets/baseball.php';
include_once dirname( __FILE__ ) . '/presets/basketball.php';
include_once dirname( __FILE__ ) . '/presets/gaming.php';
include_once dirname( __FILE__ ) . '/presets/cricket.php';
include_once dirname( __FILE__ ) . '/presets/golf.php';
include_once dirname( __FILE__ ) . '/presets/handball.php';
include_once dirname( __FILE__ ) . '/presets/hockey.php';
include_once dirname( __FILE__ ) . '/presets/racing.php';
include_once dirname( __FILE__ ) . '/presets/rugby.php';
include_once dirname( __FILE__ ) . '/presets/swimming.php';
include_once dirname( __FILE__ ) . '/presets/tennis.php';
include_once dirname( __FILE__ ) . '/presets/volleyball.php';
$sportspress_texts = array( $sportspress_texts = array(
'sp_team' => array( 'sp_team' => array(
'Enter title here' => __( 'Team', 'sportspress' ), 'Enter title here' => __( 'Team', 'sportspress' ),

View File

@@ -31,7 +31,7 @@ include dirname( __FILE__ ) . '/sportspress-globals.php' ;
require_once dirname( __FILE__ ) . '/sportspress-functions.php'; require_once dirname( __FILE__ ) . '/sportspress-functions.php';
// Settings // Settings
include dirname( __FILE__ ) . '/admin/options/options.php' ; include dirname( __FILE__ ) . '/admin/settings/settings.php' ;
// Custom Post Types // Custom Post Types
require_once dirname( __FILE__ ) . '/admin/post-types/separator.php'; require_once dirname( __FILE__ ) . '/admin/post-types/separator.php';
@@ -50,6 +50,9 @@ require_once dirname( __FILE__ ) . '/admin/post-types/staff.php';
require_once dirname( __FILE__ ) . '/admin/terms/league.php'; require_once dirname( __FILE__ ) . '/admin/terms/league.php';
require_once dirname( __FILE__ ) . '/admin/terms/position.php'; require_once dirname( __FILE__ ) . '/admin/terms/position.php';
// Presets
include dirname( __FILE__ ) . '/presets/presets.php' ;
// Install // Install
include dirname( __FILE__ ) . '/install.php'; include dirname( __FILE__ ) . '/install.php';