From 6cf7e5b77ee8ca7cb21adbccd9a953c0c84f3cb8 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Sat, 4 Jan 2014 13:19:42 +1100 Subject: [PATCH] Clean up config settings page tables --- admin/post-types/column.php | 1 - admin/post-types/statistic.php | 2 +- admin/{options => settings}/config.php | 26 +++++++++++++++++-- admin/{options => settings}/general.php | 0 .../options.php => settings/settings.php} | 0 presets/presets.php | 21 +++++++++++++++ sportspress-actions.php | 4 +-- sportspress-filters.php | 3 +++ sportspress-functions.php | 1 - sportspress-globals.php | 17 ------------ sportspress.php | 5 +++- 11 files changed, 55 insertions(+), 25 deletions(-) rename admin/{options => settings}/config.php (86%) rename admin/{options => settings}/general.php (100%) rename admin/{options/options.php => settings/settings.php} (100%) create mode 100644 presets/presets.php diff --git a/admin/post-types/column.php b/admin/post-types/column.php index 15122581..17f2fa59 100644 --- a/admin/post-types/column.php +++ b/admin/post-types/column.php @@ -25,7 +25,6 @@ function sp_column_edit_columns() { 'title' => __( 'Label', 'sportspress' ), 'sp_equation' => __( 'Equation', 'sportspress' ), 'sp_order' => __( 'Sort Order', 'sportspress' ), - 'sp_key' => __( 'Key', 'sportspress' ), 'sp_abbreviation' => __( 'Abbreviation', 'sportspress' ) ); return $columns; diff --git a/admin/post-types/statistic.php b/admin/post-types/statistic.php index a683f4d3..c9c77625 100644 --- a/admin/post-types/statistic.php +++ b/admin/post-types/statistic.php @@ -24,7 +24,7 @@ function sp_statistic_edit_columns() { 'cb' => '', 'title' => __( 'Label', 'sportspress' ), 'sp_equation' => __( 'Equation', 'sportspress' ), - 'sp_key' => __( 'Key', 'sportspress' ), + 'sp_order' => __( 'Sort Order', 'sportspress' ), 'sp_abbreviation' => __( 'Abbreviation', 'sportspress' ) ); return $columns; diff --git a/admin/options/config.php b/admin/settings/config.php similarity index 86% rename from admin/options/config.php rename to admin/settings/config.php index b0e1ea20..2919dbe8 100644 --- a/admin/options/config.php +++ b/admin/settings/config.php @@ -15,6 +15,7 @@ + @@ -48,11 +49,21 @@ endif; ?> + + ID, 'sp_abbreviation', true ); + if ( $abbreviation ): + echo $abbreviation; + else: + echo $row->post_title; + endif; + ?> + - + @@ -74,6 +85,7 @@ + @@ -107,11 +119,21 @@ endif; ?> + + ID, 'sp_abbreviation', true ); + if ( $abbreviation ): + echo $abbreviation; + else: + echo $row->post_title; + endif; + ?> + - + diff --git a/admin/options/general.php b/admin/settings/general.php similarity index 100% rename from admin/options/general.php rename to admin/settings/general.php diff --git a/admin/options/options.php b/admin/settings/settings.php similarity index 100% rename from admin/options/options.php rename to admin/settings/settings.php diff --git a/presets/presets.php b/presets/presets.php new file mode 100644 index 00000000..32d231b0 --- /dev/null +++ b/presets/presets.php @@ -0,0 +1,21 @@ + __( 'Custom', 'sportspress' ), 'posts' => array() ); +?> \ No newline at end of file diff --git a/sportspress-actions.php b/sportspress-actions.php index 7c40d73f..e308f0d7 100644 --- a/sportspress-actions.php +++ b/sportspress-actions.php @@ -133,7 +133,7 @@ add_action( 'manage_posts_columns', 'sp_manage_posts_columns' ); function sp_restrict_manage_posts() { sp_highlight_admin_menu(); 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; $args = array( 'show_option_none' => sprintf( __( 'All %s', 'sportspress' ), __( 'Teams', 'sportspress' ) ), @@ -143,7 +143,7 @@ function sp_restrict_manage_posts() { ); // wp_dropdown_pages( $args ); 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; $args = array( 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ), diff --git a/sportspress-filters.php b/sportspress-filters.php index 98a7c5f2..79421ef5 100644 --- a/sportspress-filters.php +++ b/sportspress-filters.php @@ -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' ) ) ): $wp_query->set( 'orderby', 'menu_order' ); $wp_query->set( 'order', 'ASC' ); + elseif ( $post_type == 'sp_event' ): + $wp_query->set( 'orderby', 'post_date' ); + $wp_query->set( 'order', 'ASC' ); endif; endif; } diff --git a/sportspress-functions.php b/sportspress-functions.php index c9556336..cb0fdc7c 100644 --- a/sportspress-functions.php +++ b/sportspress-functions.php @@ -1348,7 +1348,6 @@ if ( !function_exists( 'sp_get_list_html' ) ) { } } - if ( !function_exists( 'sp_highlight_admin_menu' ) ) { function sp_highlight_admin_menu() { global $parent_file, $submenu_file; diff --git a/sportspress-globals.php b/sportspress-globals.php index 631de2e3..baceb88d 100644 --- a/sportspress-globals.php +++ b/sportspress-globals.php @@ -1,21 +1,4 @@ array( 'Enter title here' => __( 'Team', 'sportspress' ), diff --git a/sportspress.php b/sportspress.php index c8dedd84..f8505672 100644 --- a/sportspress.php +++ b/sportspress.php @@ -31,7 +31,7 @@ include dirname( __FILE__ ) . '/sportspress-globals.php' ; require_once dirname( __FILE__ ) . '/sportspress-functions.php'; // Settings -include dirname( __FILE__ ) . '/admin/options/options.php' ; +include dirname( __FILE__ ) . '/admin/settings/settings.php' ; // Custom Post Types 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/position.php'; +// Presets +include dirname( __FILE__ ) . '/presets/presets.php' ; + // Install include dirname( __FILE__ ) . '/install.php';