From 3d492f4d80684e4c9a052bc23c231c94990fdf79 Mon Sep 17 00:00:00 2001 From: ThemeBoy Date: Mon, 25 Nov 2013 11:32:39 +1100 Subject: [PATCH] Finalize term names and add divider --- actions.php | 34 +++-- division.php | 6 +- event.php | 5 +- globals.php | 18 +-- helpers.php | 6 +- list.php | 12 +- player.php | 17 +-- position.php | 6 +- presets.php | 286 ------------------------------------------ readme.txt | 10 +- sportspress-admin.css | 4 +- sportspress.php | 4 +- staff.php | 7 +- table.php | 14 +-- team.php | 13 +- 15 files changed, 84 insertions(+), 358 deletions(-) delete mode 100644 presets.php diff --git a/actions.php b/actions.php index 06f31190..cb1a7c11 100644 --- a/actions.php +++ b/actions.php @@ -10,14 +10,22 @@ function sp_after_theme_setup() { } add_action( 'after_theme_setup', 'sp_after_theme_setup' ); +function sp_admin_menu_separator() { + if ( ! current_user_can( 'manage_options' ) ) + return; + global $menu; + $menu[41] = array( '', 'read', 'separator-sportspress', '', 'wp-menu-separator sportspress' ); +} +add_action( 'admin_menu', 'sp_admin_menu_separator' ); + function sp_manage_posts_custom_column( $column, $post_id ) { global $post; switch ( $column ): - case 'sp_icon': + case 'sp_logo': edit_post_link( get_the_post_thumbnail( $post_id, 'sp_icon' ), '', '', $post_id ); break; - case 'sp_position': - echo get_the_terms ( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : '—'; + case 'sp_pos': + echo get_the_terms ( $post_id, 'sp_pos' ) ? the_terms( $post_id, 'sp_pos' ) : '—'; break; case 'sp_team': $result = get_post_meta( $post_id, 'sp_result', false ); @@ -29,8 +37,8 @@ function sp_manage_posts_custom_column( $column, $post_id ) { case 'sp_event': echo get_post_meta ( $post_id, 'sp_event' ) ? sizeof( get_post_meta ( $post_id, 'sp_event' ) ) : '—'; break; - case 'sp_division': - echo get_the_terms ( $post_id, 'sp_division' ) ? the_terms( $post_id, 'sp_division' ) : '—'; + case 'sp_div': + echo get_the_terms ( $post_id, 'sp_div' ) ? the_terms( $post_id, 'sp_div' ) : '—'; break; case 'sp_sponsor': echo get_the_terms ( $post_id, 'sp_sponsor' ) ? the_terms( $post_id, 'sp_sponsor' ) : '—'; @@ -59,21 +67,21 @@ function sp_restrict_manage_posts() { wp_dropdown_pages( $args ); endif; if ( in_array( $typenow, array( 'sp_player', 'sp_staff' ) ) ): - $selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null; + $selected = isset( $_REQUEST['sp_pos'] ) ? $_REQUEST['sp_pos'] : null; $args = array( 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ), - 'taxonomy' => 'sp_position', - 'name' => 'sp_position', + 'taxonomy' => 'sp_pos', + 'name' => 'sp_pos', 'selected' => $selected ); sp_dropdown_taxonomies( $args ); endif; if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_list' ) ) ): - $selected = isset( $_REQUEST['sp_division'] ) ? $_REQUEST['sp_division'] : null; + $selected = isset( $_REQUEST['sp_div'] ) ? $_REQUEST['sp_div'] : null; $args = array( 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Divisions', 'sportspress' ) ), - 'taxonomy' => 'sp_division', - 'name' => 'sp_division', + 'taxonomy' => 'sp_div', + 'name' => 'sp_div', 'selected' => $selected ); sp_dropdown_taxonomies( $args ); @@ -131,13 +139,13 @@ function sp_save_post( $post_id ) { break; case ( 'sp_table' ): update_post_meta( $post_id, 'sp_stats', sp_array_value( $_POST, 'sp_stats', array() ) ); - wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_division', 0 ), 'sp_division' ); + wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_div', 0 ), 'sp_div' ); sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) ); break; case ( 'sp_list' ): update_post_meta( $post_id, 'sp_stats', sp_array_value( $_POST, 'sp_stats', array() ) ); update_post_meta( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) ); - wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_division', 0 ), 'sp_division' ); + wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_div', 0 ), 'sp_div' ); sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) ); break; endswitch; diff --git a/division.php b/division.php index 12ead5f5..ab233d47 100644 --- a/division.php +++ b/division.php @@ -1,5 +1,5 @@ true, 'rewrite' => array( 'slug' => 'division' ), ); - register_taxonomy( 'sp_division', $object_type, $args ); + register_taxonomy( 'sp_div', $object_type, $args ); } -add_action( 'init', 'sp_division_tax_init' ); +add_action( 'init', 'sp_div_tax_init' ); ?> \ No newline at end of file diff --git a/event.php b/event.php index e82a9810..472368ca 100644 --- a/event.php +++ b/event.php @@ -11,7 +11,8 @@ function sp_event_cpt_init() { 'hierarchical' => false, 'supports' => array( 'title', 'author', 'comments' ), 'register_meta_box_cb' => 'sp_event_meta_init', - 'rewrite' => array( 'slug' => 'event' ) + 'rewrite' => array( 'slug' => 'event' ), + 'menu_position' => 44 ); register_post_type( 'sp_event', $args ); } @@ -131,7 +132,7 @@ function sp_event_edit_columns() { 'cb' => '', 'title' => __( 'Event', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_division' => __( 'Divisions', 'sportspress' ), + 'sp_div' => __( 'Divisions', 'sportspress' ), 'sp_kickoff' => __( 'Kick-off', 'sportspress' ) ); return $columns; diff --git a/globals.php b/globals.php index 696aad0c..bdc5a675 100644 --- a/globals.php +++ b/globals.php @@ -2,8 +2,8 @@ $sportspress_texts = array( 'sp_team' => array( 'Enter title here' => __( 'Team', 'sportspress' ), - 'Set featured image' => sprintf( __( 'Add %s', 'sportspress' ), __( 'Logo', 'sportspress' ) ), - 'Set Featured Image' => sprintf( __( 'Add %s', 'sportspress' ), __( 'Logo', 'sportspress' ) ), + 'Set featured image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Logo', 'sportspress' ) ), + 'Set Featured Image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Logo', 'sportspress' ) ), 'Parent' => sprintf( __( 'Parent %s', 'sportspress' ), __( 'Team', 'sportspress' ) ), 'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Logo', 'sportspress' ) ) ), @@ -15,8 +15,8 @@ $sportspress_texts = array( ), 'sp_player' => array( 'Enter title here' => __( 'Name', 'sportspress' ), - 'Set featured image' => sprintf( __( 'Add %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), - 'Set Featured Image' => sprintf( __( 'Add %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), + 'Set featured image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), + 'Set Featured Image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), 'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), 'Scheduled for: %1$s' => __( 'Joined', 'sportspress' ) . ': %1$s', 'Published on: %1$s' => __( 'Joined', 'sportspress' ) . ': %1$s', @@ -24,8 +24,8 @@ $sportspress_texts = array( ), 'sp_staff' => array( 'Enter title here' => __( 'Name', 'sportspress' ), - 'Set featured image' => sprintf( __( 'Add %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), - 'Set Featured Image' => sprintf( __( 'Add %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), + 'Set featured image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), + 'Set Featured Image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), 'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), 'Scheduled for: %1$s' => __( 'Joined', 'sportspress' ) . ': %1$s', 'Published on: %1$s' => __( 'Joined', 'sportspress' ) . ': %1$s', @@ -38,15 +38,15 @@ $sportspress_texts = array( $sportspress_thumbnail_texts = array( 'sp_team' => array( - 'Set featured image' => sprintf( __( 'Add %s', 'sportspress' ), __( 'Logo', 'sportspress' ) ), + 'Set featured image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Logo', 'sportspress' ) ), 'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Logo', 'sportspress' ) ) ), 'sp_player' => array( - 'Set featured image' => sprintf( __( 'Add %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), + 'Set featured image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), 'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ) ), 'sp_staff' => array( - 'Set featured image' => sprintf( __( 'Add %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), + 'Set featured image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), 'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ) ) ); diff --git a/helpers.php b/helpers.php index 4e550796..f13060a0 100644 --- a/helpers.php +++ b/helpers.php @@ -210,7 +210,7 @@ if ( !function_exists( 'sp_post_checklist' ) ) { $parents = get_post_ancestors( $post ); if ( $filter ): $filter_values = (array)get_post_meta( $post->ID, $filter, false ); - $terms = (array)get_the_terms( $post->ID, 'sp_division' ); + $terms = (array)get_the_terms( $post->ID, 'sp_div' ); foreach ( $terms as $term ): if ( is_object( $term ) && property_exists( $term, 'term_id' ) ) $filter_values[] = $term->term_id; @@ -249,7 +249,7 @@ if ( !function_exists( 'sp_post_checklist' ) ) { if ( !function_exists( 'sp_get_eos_rows' ) ) { function sp_get_eos_rows( $raw ) { $raw = str_replace( array( "\r\n", ' ' ), array( "\n", '' ), $raw ); - $output = explode( "\n", $raw ); + $output = explode( "\r\n", $raw ); return $output; } } @@ -257,7 +257,7 @@ if ( !function_exists( 'sp_get_eos_rows' ) ) { if ( !function_exists( 'sp_get_eos_keys' ) ) { function sp_get_eos_keys( $raw ) { $raw = str_replace( array( "\r\n", ' :' ), array( "\n", ':' ), $raw ); - $arr = explode( "\n", $raw ); + $arr = explode( "\r\n", $raw ); $output = array(); foreach ( $arr as $value ): $output[] = substr( $value, 0, strpos( $value, ':') ); diff --git a/list.php b/list.php index 893f4030..b7b362fb 100644 --- a/list.php +++ b/list.php @@ -24,7 +24,7 @@ function sp_list_edit_columns() { 'title' => __( 'Title' ), 'sp_player' => __( 'Players', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_division' => __( 'Divisions', 'sportspress' ) + 'sp_div' => __( 'Divisions', 'sportspress' ) ); return $columns; } @@ -36,7 +36,7 @@ function sp_list_meta_init() { } function sp_list_player_meta( $post ) { - $division_id = sp_get_the_term_id( $post->ID, 'sp_division', 0 ); + $division_id = sp_get_the_term_id( $post->ID, 'sp_div', 0 ); $team_id = get_post_meta( $post->ID, 'sp_team', true ); ?>
@@ -44,8 +44,8 @@ function sp_list_player_meta( $post ) { sprintf( __( 'All %s', 'sportspress' ), __( 'Divisions', 'sportspress' ) ), - 'taxonomy' => 'sp_division', - 'name' => 'sp_division', + 'taxonomy' => 'sp_div', + 'name' => 'sp_div', 'selected' => $division_id ); sp_dropdown_taxonomies( $args ); @@ -75,7 +75,7 @@ function sp_list_player_meta( $post ) { function sp_list_stats_meta( $post ) { $players = (array)get_post_meta( $post->ID, 'sp_player', false ); $stats = (array)get_post_meta( $post->ID, 'sp_stats', true ); - $division_id = sp_get_the_term_id( $post->ID, 'sp_division', 0 ); + $division_id = sp_get_the_term_id( $post->ID, 'sp_div', 0 ); $team_id = get_post_meta( $post->ID, 'sp_team', true ); $data = sp_array_combine( $players, sp_array_value( $stats, $division_id, array() ) ); @@ -92,7 +92,7 @@ function sp_list_stats_meta( $post ) { ), 'tax_query' => array( array( - 'taxonomy' => 'sp_division', + 'taxonomy' => 'sp_div', 'field' => 'id', 'terms' => $division_id ) diff --git a/player.php b/player.php index 7702176c..49ae292b 100644 --- a/player.php +++ b/player.php @@ -11,7 +11,8 @@ function sp_player_cpt_init() { 'hierarchical' => false, 'supports' => array( 'title', 'author', 'thumbnail' ), 'register_meta_box_cb' => 'sp_player_meta_init', - 'rewrite' => array( 'slug' => 'player' ) + 'rewrite' => array( 'slug' => 'player' ), + 'menu_position' => 45 ); register_post_type( 'sp_player', $args ); } @@ -35,7 +36,7 @@ function sp_player_team_meta( $post ) { function sp_player_stats_meta( $post ) { $teams = (array)get_post_meta( $post->ID, 'sp_team', false ); - $divisions = (array)get_the_terms( $post->ID, 'sp_division' ); + $divisions = (array)get_the_terms( $post->ID, 'sp_div' ); $stats = (array)get_post_meta( $post->ID, 'sp_stats', true ); // Get column names from settings @@ -70,7 +71,7 @@ function sp_player_stats_meta( $post ) { if ( $division_id ): $args['tax_query'] = array( array( - 'taxonomy' => 'sp_division', + 'taxonomy' => 'sp_div', 'field' => 'id', 'terms' => $division_id ) @@ -82,7 +83,7 @@ function sp_player_stats_meta( $post ) {

array( array( - 'taxonomy' => 'sp_division', + 'taxonomy' => 'sp_div', 'field' => 'id', 'terms' => $division_id ) @@ -120,7 +121,7 @@ function sp_player_stats_meta( $post ) {

'', 'title' => __( 'Name', 'sportspress' ), - 'sp_position' => __( 'Positions', 'sportspress' ), + 'sp_pos' => __( 'Positions', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_division' => __( 'Divisions', 'sportspress' ) + 'sp_div' => __( 'Divisions', 'sportspress' ) ); return $columns; } diff --git a/position.php b/position.php index 9f85b30b..79632b96 100644 --- a/position.php +++ b/position.php @@ -1,5 +1,5 @@ true, 'rewrite' => array( 'slug' => 'position' ), ); - register_taxonomy( 'sp_position', $object_type, $args ); + register_taxonomy( 'sp_pos', $object_type, $args ); } -add_action( 'init', 'sp_position_tax_init' ); +add_action( 'init', 'sp_pos_tax_init' ); ?> \ No newline at end of file diff --git a/presets.php b/presets.php deleted file mode 100644 index 819bacf7..00000000 --- a/presets.php +++ /dev/null @@ -1,286 +0,0 @@ - array( - 'team' => - 'P' . ': $played' . "\r\n" . - 'W' . ': $wins' . "\r\n" . - 'D' . ': $ties' . "\r\n" . - 'L' . ': $losses' . "\r\n" . - 'F' . ': $for' . "\r\n" . - 'A' . ': $against' . "\r\n" . - 'GD' . ': $for - $against' . "\r\n" . - 'PTS' . ': 3 * $wins + $ties', - 'event' => - '1' . ': $first' . "\r\n" . - '2' . ': $second' . "\r\n" . - '3' . ': $third' . "\r\n" . - '4' . ': $fourth' . "\r\n" . - '5' . ': $fifth' . "\r\n" . - '6' . ': $sixth' . "\r\n" . - '7' . ': $seventh' . "\r\n" . - '8' . ': $eigth' . "\r\n" . - '9' . ': $ninth' . "\r\n" . - ' ' . ': $extra' . "\r\n" . - 'R' . ': $runs' . "\r\n" . - 'H' . ': $hits' . "\r\n" . - 'E' . ': $errors:' . "\r\n" . - 'LOB' . ': $lob', - 'player' => - array( - 'G' . ': $played' . "\r\n" . - 'AB' . ': $ab' . "\r\n" . - 'R' . ': $runs' . "\r\n" . - 'H' . ': $hits' . "\r\n" . - '2B' . ': $double' . "\r\n" . - '3B' . ': $triple' . "\r\n" . - 'HR' . ': $hr' . "\r\n" . - 'RBI' . ': $rbi' . "\r\n" . - 'BB' . ': $bb' . "\r\n" . - 'SO' . ': $so' . "\r\n" . - 'SB' . ': $sb' . "\r\n" . - 'CS' . ': $cs' . "\r\n" . - 'AVG' . ': $hits / $ab' . "\r\n" . - 'OBP' . ': ( $hits + $bb + $hbp ) / ( $ab + $bb + $hbp + $sf )' . "\r\n" . - 'SLG' . ': $tb / $ab' . "\r\n" . - 'OPS' . ': ( $hits + $bb + $hbp ) / ( $ab + $bb + $hbp + $sf ) + ( $tb / $ab )' - ), - array( - 'W' . ': $wins' . "\r\n" . - 'L' . ': $losses' . "\r\n" . - 'ERA' . ': ( $er * 9 ) / $ip' . "\r\n" . - 'G' . ': $played' . "\r\n" . - 'GS' . ': $gs' . "\r\n" . - 'SV' . ': $sv' . "\r\n" . - 'SVO' . ': $svo' . "\r\n" . - 'IP' . ': $ip' . "\r\n" . - 'H' . ': $hits' . "\r\n" . - 'R' . ': $runs' . "\r\n" . - 'ER' . ': $er' . "\r\n" . - 'HR' . ': $hr' . "\r\n" . - 'BB' . ': $bb' . "\r\n" . - 'SO' . ': $so' . "\r\n" . - 'AVG' . ': $hits / $ab' . "\r\n" . - 'WHIP' . ': ( $hits + $walks ) / $ip' - ), - array( - 'W' . ': $wins' . "\r\n" . - 'L' . ': $losses' . "\r\n" . - 'ERA' . ': ( $er * 9 ) / $ip' . "\r\n" . - 'G' . ': $played' . "\r\n" . - 'AB' . ': $ab' . "\r\n" . - 'R' . ': $runs' . "\r\n" . - 'H' . ': $hits' . "\r\n" . - '2B' . ': $double' . "\r\n" . - '3B' . ': $triple' . "\r\n" . - 'HR' . ': $hr' . "\r\n" . - 'RBI' . ': $rbi' . "\r\n" . - 'BB' . ': $bb' . "\r\n" . - 'SO' . ': $so' . "\r\n" . - 'SB' . ': $sb' . "\r\n" . - 'CS' . ': $cs' . "\r\n" . - 'AVG' . ': $hits / $ab' . "\r\n" . - 'OBP' . ': ( $hits + $bb + $hbp ) / ( $ab + $bb + $hbp + $sf )' . "\r\n" . - 'SLG' . ': $tb / $ab' . "\r\n" . - 'OPS' . ': ( $hits + $bb + $hbp ) / ( $ab + $bb + $hbp + $sf ) + ( $tb / $ab )' - ) - ), - 'Basketball' => array( - 'team' => - 'W' . ': $wins' . "\r\n" . - 'L' . ': $losses' . "\r\n" . - 'Pct' . ': $wins / $played' . "\r\n" . - 'GB' . ': ( $leadwins - $leadlosses + $wins - $losses ) / 2' . "\r\n" . - 'Home' . ': $homewins $homelosses' . "\r\n" . - 'Road' . ': $awaywins $awaylosses' . "\r\n" . - 'L10' . ': $lastten' . "\r\n" . - 'Streak' . ': $streak', - 'event' => - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow Cards' . ': $yellowcards' . "\r\n" . - 'Red Cards' . ': $redcards', - 'player' => - 'Attendances' . ': $played' . "\r\n" . - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow Cards' . ': $yellowcards' . "\r\n" . - 'Red Cards' . ': $redcards' - ), - 'Cricket' => array( - 'team' => - 'P' . ': $played' . "\r\n" . - 'W' . ': $wins' . "\r\n" . - 'D' . ': $ties' . "\r\n" . - 'L' . ': $losses' . "\r\n" . - 'F' . ': $for' . "\r\n" . - 'A' . ': $against' . "\r\n" . - 'GD' . ': $for - $against' . "\r\n" . - 'PTS' . ': 3 * $wins + $ties', - 'event' => - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow Cards' . ': $yellowcards' . "\r\n" . - 'Red Cards' . ': $redcards', - 'player' => - 'Attendances' . ': $played' . "\r\n" . - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow Cards' . ': $yellowcards' . "\r\n" . - 'Red Cards' . ': $redcards' - ), - 'Football (USA)' => array( - 'team' => - 'P' . ': $played' . "\r\n" . - 'W' . ': $wins' . "\r\n" . - 'D' . ': $ties' . "\r\n" . - 'L' . ': $losses' . "\r\n" . - 'F' . ': $for' . "\r\n" . - 'A' . ': $against' . "\r\n" . - 'GD' . ': $for - $against' . "\r\n" . - 'PTS' . ': 3 * $wins + $ties', - 'event' => - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow Cards' . ': $yellowcards' . "\r\n" . - 'Red Cards' . ': $redcards', - 'player' => - 'Attendances' . ': $played' . "\r\n" . - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow Cards' . ': $yellowcards' . "\r\n" . - 'Red Cards' . ': $redcards' - ), - 'Footy (Australia)' => array( - 'team' => - 'P' . ': $played' . "\r\n" . - 'W' . ': $wins' . "\r\n" . - 'D' . ': $ties' . "\r\n" . - 'L' . ': $losses' . "\r\n" . - 'F' . ': $for' . "\r\n" . - 'A' . ': $against' . "\r\n" . - 'GD' . ': $for - $against' . "\r\n" . - 'PTS' . ': 3 * $wins + $ties', - 'event' => - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow Cards' . ': $yellowcards' . "\r\n" . - 'Red Cards' . ': $redcards', - 'player' => - 'Attendances' . ': $played' . "\r\n" . - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow Cards' . ': $yellowcards' . "\r\n" . - 'Red Cards' . ': $redcards' - ), - 'Hockey' => array( - 'team' => - 'P' . ': $played' . "\r\n" . - 'W' . ': $wins' . "\r\n" . - 'D' . ': $ties' . "\r\n" . - 'L' . ': $losses' . "\r\n" . - 'F' . ': $for' . "\r\n" . - 'A' . ': $against' . "\r\n" . - 'GD' . ': $for - $against' . "\r\n" . - 'PTS' . ': 3 * $wins + $ties', - 'event' => - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow Cards' . ': $yellowcards' . "\r\n" . - 'Red Cards' . ': $redcards', - 'player' => - 'Attendances' . ': $played' . "\r\n" . - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow Cards' . ': $yellowcards' . "\r\n" . - 'Red Cards' . ': $redcards' - ), - 'Rugby' => array( - 'team' => - 'P' . ': $played' . "\r\n" . - 'W' . ': $wins' . "\r\n" . - 'D' . ': $ties' . "\r\n" . - 'L' . ': $losses' . "\r\n" . - 'F' . ': $for' . "\r\n" . - 'A' . ': $against' . "\r\n" . - 'GD' . ': $for - $against' . "\r\n" . - 'PTS' . ': 3 * $wins + $ties', - 'event' => - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow' . ' Cards: $yellowcards' . "\r\n" . - 'Red' . ' Cards: $redcards', - 'player' => - 'Attendances' . ': $played' . "\r\n" . - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow' . ' Cards: $yellowcards' . "\r\n" . - 'Red' . ' Cards: $redcards' - ), - 'soccer' => array( - 'team' => - 'P' . ': $played' . "\r\n" . - 'W' . ': $wins' . "\r\n" . - 'D' . ': $ties' . "\r\n" . - 'L' . ': $losses' . "\r\n" . - 'F' . ': $for' . "\r\n" . - 'A' . ': $against' . "\r\n" . - 'GD' . ': $for - $against' . "\r\n" . - 'PTS' . ': 3 * $wins + $ties', - 'event' => - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow Cards' . ': $yellowcards' . "\r\n" . - 'Red Cards' . ': $redcards', - 'player' => - 'Attendances' . ': $played' . "\r\n" . - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow Cards' . ': $yellowcards' . "\r\n" . - 'Red Cards' . ': $redcards' - ), - 'Tennis' => array( - 'team' => - 'P' . ': $played' . "\r\n" . - 'W' . ': $wins' . "\r\n" . - 'D' . ': $ties' . "\r\n" . - 'L' . ': $losses' . "\r\n" . - 'F' . ': $for' . "\r\n" . - 'A' . ': $against' . "\r\n" . - 'GD' . ': $for - $against' . "\r\n" . - 'PTS' . ': 3 * $wins + $ties', - 'event' => - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow' . ' Cards: $yellowcards' . "\r\n" . - 'Red' . ' Cards: $redcards', - 'player' => - 'Attendances' . ': $played' . "\r\n" . - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow' . ' Cards: $yellowcards' . "\r\n" . - 'Red' . ' Cards: $redcards' - ), - 'Volleyball' => array( - 'team' => - 'P' . ': $played' . "\r\n" . - 'W' . ': $wins' . "\r\n" . - 'D' . ': $ties' . "\r\n" . - 'L' . ': $losses' . "\r\n" . - 'F' . ': $for' . "\r\n" . - 'A' . ': $against' . "\r\n" . - 'GD' . ': $for - $against' . "\r\n" . - 'PTS' . ': 3 * $wins + $ties', - 'event' => - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow' . ' Cards: $yellowcards' . "\r\n" . - 'Red' . ' Cards: $redcards', - 'player' => - 'Attendances' . ': $played' . "\r\n" . - 'Goals' . ': $goals' . "\r\n" . - 'Assists' . ': $assists' . "\r\n" . - 'Yellow' . ' Cards: $yellowcards' . "\r\n" . - 'Red' . ' Cards: $redcards' - ) -); -?> \ No newline at end of file diff --git a/readme.txt b/readme.txt index 95dc8e01..19d83a12 100644 --- a/readme.txt +++ b/readme.txt @@ -1,15 +1,15 @@ -=== SportsPress - flexible sports management === +=== SportsPress === Contributors: themeboy Tags: sports, sports journalism, teams, team management, fixtures, results, standings, league tables, divisions, reporting, themeboy, wordpress sports, configurable, variable, widgets Requires at least: 3.5 Tested up to: 3.6 -Stable tag: 1.0 +Stable tag: 0.1 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html -SportsPress is a powerful, flexible sports management plugin that helps you broadcast your team to the world. +SportsPress is a flexible sports management plugin that adds team management functionality to WordPress. Currently in alpha for theme development and testing purposes. == Changelog == -= 1.0 - 23/09/2013 = -* Initial Release. Game on! \ No newline at end of file += 0.1 - 23/11/2013 = +* Alpha release for first look and testing. \ No newline at end of file diff --git a/sportspress-admin.css b/sportspress-admin.css index 21d870e1..05c084ad 100644 --- a/sportspress-admin.css +++ b/sportspress-admin.css @@ -104,8 +104,8 @@ min-width: 14px; width: 100%; } -.widefat th.column-sp_icon, -.widefat td.column-sp_icon { +.widefat th.column-sp_logo, +.widefat td.column-sp_logo { width: 32px; text-align: center; } diff --git a/sportspress.php b/sportspress.php index 0b4367f8..3ec88b61 100644 --- a/sportspress.php +++ b/sportspress.php @@ -6,7 +6,7 @@ Plugin Name: SportsPress Plugin URI: http://themeboy.com/sportspress Description: Manage your club and its players, staff, events, league tables, and player lists. -Version: 1.0 +Version: 0.1 Author: ThemeBoy Author URI: http://themeboy.com License: GPLv3 @@ -18,7 +18,7 @@ if ( !function_exists( 'add_action' ) ) { exit; } -define( 'SPORTSPRESS_VERSION', '1.0' ); +define( 'SPORTSPRESS_VERSION', '0.1' ); define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); // Libraries diff --git a/staff.php b/staff.php index b9955a60..60e5f147 100644 --- a/staff.php +++ b/staff.php @@ -11,7 +11,8 @@ function sp_staff_cpt_init() { 'hierarchical' => false, 'supports' => array( 'title', 'author', 'thumbnail' ), 'register_meta_box_cb' => 'sp_staff_meta_init', - 'rewrite' => array( 'slug' => 'staff' ) + 'rewrite' => array( 'slug' => 'staff' ), + 'menu_position' => 46 ); register_post_type( 'sp_staff', $args ); } @@ -39,9 +40,9 @@ function sp_staff_edit_columns() { $columns = array( 'cb' => '', 'title' => __( 'Name', 'sportspress' ), - 'sp_position' => __( 'Positions', 'sportspress' ), + 'sp_pos' => __( 'Positions', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_division' => __( 'Divisions', 'sportspress' ), + 'sp_div' => __( 'Divisions', 'sportspress' ), ); return $columns; } diff --git a/table.php b/table.php index cfd10676..c57e679d 100644 --- a/table.php +++ b/table.php @@ -23,7 +23,7 @@ function sp_table_edit_columns() { 'cb' => '', 'title' => __( 'Title' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_division' => __( 'Divisions', 'sportspress' ), + 'sp_div' => __( 'Divisions', 'sportspress' ), ); return $columns; } @@ -35,22 +35,22 @@ function sp_table_meta_init() { } function sp_table_team_meta( $post ) { - $division_id = sp_get_the_term_id( $post->ID, 'sp_division', 0 ); + $division_id = sp_get_the_term_id( $post->ID, 'sp_div', 0 ); ?>

sprintf( __( 'All %s', 'sportspress' ), __( 'Divisions', 'sportspress' ) ), - 'taxonomy' => 'sp_division', - 'name' => 'sp_division', + 'taxonomy' => 'sp_div', + 'name' => 'sp_div', 'selected' => $division_id ); sp_dropdown_taxonomies( $args ); ?>

ID, 'sp_team', 'block', 'sp_division' ); + sp_post_checklist( $post->ID, 'sp_team', 'block', 'sp_div' ); sp_post_adder( 'sp_team' ); ?>
@@ -61,7 +61,7 @@ function sp_table_team_meta( $post ) { function sp_table_stats_meta( $post ) { $teams = (array)get_post_meta( $post->ID, 'sp_team', false ); $stats = (array)get_post_meta( $post->ID, 'sp_stats', true ); - $division_id = sp_get_the_term_id( $post->ID, 'sp_division', 0 ); + $division_id = sp_get_the_term_id( $post->ID, 'sp_div', 0 ); $data = sp_array_combine( $teams, sp_array_value( $stats, $division_id, array() ) ); // Generate array of placeholder values for each team @@ -77,7 +77,7 @@ function sp_table_stats_meta( $post ) { ), 'tax_query' => array( array( - 'taxonomy' => 'sp_division', + 'taxonomy' => 'sp_div', 'field' => 'id', 'terms' => $division_id ) diff --git a/team.php b/team.php index 109afabc..d0768781 100644 --- a/team.php +++ b/team.php @@ -11,7 +11,8 @@ function sp_team_cpt_init() { 'hierarchical' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ), 'register_meta_box_cb' => 'sp_team_meta_init', - 'rewrite' => array( 'slug' => 'team' ) + 'rewrite' => array( 'slug' => 'team' ), + 'menu_position' => 43 ); register_post_type( 'sp_team', $args ); } @@ -28,16 +29,16 @@ function sp_team_meta_init() { function sp_team_edit_columns() { $columns = array( 'cb' => '', - 'sp_icon' => ' ', + 'sp_logo' => ' ', 'title' => __( 'Team', 'sportspress' ), - 'sp_division' => __( 'Divisions', 'sportspress' ) + 'sp_div' => __( 'Divisions', 'sportspress' ) ); return $columns; } add_filter( 'manage_edit-sp_team_columns', 'sp_team_edit_columns' ); function sp_team_stats_meta( $post ) { - $divisions = (array)get_the_terms( $post->ID, 'sp_division' ); + $divisions = (array)get_the_terms( $post->ID, 'sp_div' ); $stats = (array)get_post_meta( $post->ID, 'sp_stats', true ); // Generate array of all division ids @@ -63,7 +64,7 @@ function sp_team_stats_meta( $post ) { ), 'tax_query' => array( array( - 'taxonomy' => 'sp_division', + 'taxonomy' => 'sp_div', 'field' => 'id', 'terms' => $division_id ) @@ -79,7 +80,7 @@ function sp_team_stats_meta( $post ) { // Add first column label array_unshift( $columns, __( 'Division', 'sportspress' ) ); - sp_stats_table( $data, $placeholders, 0, $columns, false, 'sp_division' ); + sp_stats_table( $data, $placeholders, 0, $columns, false, 'sp_div' ); sp_nonce(); } ?> \ No newline at end of file