Finalize term names and add divider
This commit is contained in:
34
actions.php
34
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;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
function sp_division_tax_init() {
|
||||
function sp_div_tax_init() {
|
||||
$name = __( 'Divisions', 'sportspress' );
|
||||
$singular_name = __( 'Division', 'sportspress' );
|
||||
$lowercase_name = __( 'divisions', 'sportspress' );
|
||||
@@ -12,7 +12,7 @@ function sp_division_tax_init() {
|
||||
'hierarchical' => 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' );
|
||||
?>
|
||||
@@ -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' => '<input type="checkbox" />',
|
||||
'title' => __( 'Event', 'sportspress' ),
|
||||
'sp_team' => __( 'Teams', 'sportspress' ),
|
||||
'sp_division' => __( 'Divisions', 'sportspress' ),
|
||||
'sp_div' => __( 'Divisions', 'sportspress' ),
|
||||
'sp_kickoff' => __( 'Kick-off', 'sportspress' )
|
||||
);
|
||||
return $columns;
|
||||
|
||||
18
globals.php
18
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: <b>%1$s</b>' => __( 'Joined', 'sportspress' ) . ': <b>%1$s</b>',
|
||||
'Published on: <b>%1$s</b>' => __( 'Joined', 'sportspress' ) . ': <b>%1$s</b>',
|
||||
@@ -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: <b>%1$s</b>' => __( 'Joined', 'sportspress' ) . ': <b>%1$s</b>',
|
||||
'Published on: <b>%1$s</b>' => __( 'Joined', 'sportspress' ) . ': <b>%1$s</b>',
|
||||
@@ -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' ) )
|
||||
)
|
||||
);
|
||||
|
||||
@@ -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, ':') );
|
||||
|
||||
12
list.php
12
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 );
|
||||
?>
|
||||
<div>
|
||||
@@ -44,8 +44,8 @@ function sp_list_player_meta( $post ) {
|
||||
<?php
|
||||
$args = array(
|
||||
'show_option_all' => 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
|
||||
)
|
||||
|
||||
17
player.php
17
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 ) {
|
||||
<p><strong><?php _e( 'Overall', 'sportspress' ); ?></strong></p>
|
||||
<?php
|
||||
|
||||
sp_stats_table( $data, $placeholders, 0, $columns, true, 'sp_division' );
|
||||
sp_stats_table( $data, $placeholders, 0, $columns, true, 'sp_div' );
|
||||
|
||||
// Divisions
|
||||
foreach ( $teams as $team ):
|
||||
@@ -108,7 +109,7 @@ function sp_player_stats_meta( $post ) {
|
||||
),
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'sp_division',
|
||||
'taxonomy' => 'sp_div',
|
||||
'field' => 'id',
|
||||
'terms' => $division_id
|
||||
)
|
||||
@@ -120,7 +121,7 @@ function sp_player_stats_meta( $post ) {
|
||||
<p><strong><?php echo get_the_title( $team ); ?></strong></p>
|
||||
<?php
|
||||
|
||||
sp_stats_table( $data, $placeholders, $team, $columns, true, 'sp_division' );
|
||||
sp_stats_table( $data, $placeholders, $team, $columns, true, 'sp_div' );
|
||||
|
||||
?>
|
||||
<?php
|
||||
@@ -136,9 +137,9 @@ function sp_player_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'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;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
function sp_position_tax_init() {
|
||||
function sp_pos_tax_init() {
|
||||
$name = __( 'Positions', 'sportspress' );
|
||||
$singular_name = __( 'Position', 'sportspress' );
|
||||
$lowercase_name = __( 'position', 'sportspress' );
|
||||
@@ -12,7 +12,7 @@ function sp_position_tax_init() {
|
||||
'hierarchical' => 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' );
|
||||
?>
|
||||
286
presets.php
286
presets.php
@@ -1,286 +0,0 @@
|
||||
<?php
|
||||
$sportspress_presets = array(
|
||||
'Baseball' => 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'
|
||||
)
|
||||
);
|
||||
?>
|
||||
10
readme.txt
10
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!
|
||||
= 0.1 - 23/11/2013 =
|
||||
* Alpha release for first look and testing.
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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' => '<input type="checkbox" />',
|
||||
'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;
|
||||
}
|
||||
|
||||
14
table.php
14
table.php
@@ -23,7 +23,7 @@ function sp_table_edit_columns() {
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'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 );
|
||||
?>
|
||||
<div>
|
||||
<p class="sp-tab-select">
|
||||
<?php
|
||||
$args = array(
|
||||
'show_option_all' => 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 );
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
sp_post_checklist( $post->ID, 'sp_team', 'block', 'sp_division' );
|
||||
sp_post_checklist( $post->ID, 'sp_team', 'block', 'sp_div' );
|
||||
sp_post_adder( 'sp_team' );
|
||||
?>
|
||||
</div>
|
||||
@@ -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
|
||||
)
|
||||
|
||||
13
team.php
13
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' => '<input type="checkbox" />',
|
||||
'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();
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user