Change Leagues (sp_league) to Seasons (sp_season)

This commit is contained in:
Brian Miyaji
2014-01-04 19:55:58 +11:00
parent 6cf7e5b77e
commit 997226195d
13 changed files with 123 additions and 51 deletions

View File

@@ -39,7 +39,11 @@ function sp_column_details_meta( $post ) {
$equation = explode( ' ', get_post_meta( $post->ID, 'sp_equation', true ) ); $equation = explode( ' ', get_post_meta( $post->ID, 'sp_equation', true ) );
$order = get_post_meta( $post->ID, 'sp_order', true ); $order = get_post_meta( $post->ID, 'sp_order', true );
$priority = get_post_meta( $post->ID, 'sp_priority', true ); $priority = get_post_meta( $post->ID, 'sp_priority', true );
$precision = get_post_meta( $post->ID, 'sp_precision', true );
$abbreviation = get_post_meta( $post->ID, 'sp_abbreviation', true ); $abbreviation = get_post_meta( $post->ID, 'sp_abbreviation', true );
// Defaults
if ( $precision == '' ) $precision = 1;
?> ?>
<p><strong><?php _e( 'Equation', 'sportspress' ); ?></strong></p> <p><strong><?php _e( 'Equation', 'sportspress' ); ?></strong></p>
<p class="sp-equation-selector"> <p class="sp-equation-selector">
@@ -68,6 +72,10 @@ function sp_column_details_meta( $post ) {
?> ?>
</select> </select>
</p> </p>
<p><strong><?php _e( 'Precision', 'sportspress' ); ?></strong></p>
<p>
<input name="sp_precision" type="text" size="4" id="sp_precision" value="<?php echo $precision; ?>">
</p>
<p><strong><?php _e( 'Abbreviation', 'sportspress' ); ?></strong></p> <p><strong><?php _e( 'Abbreviation', 'sportspress' ); ?></strong></p>
<p> <p>
<input name="sp_abbreviation" type="text" size="4" id="sp_abbreviation" value="<?php echo $abbreviation; ?>"> <input name="sp_abbreviation" type="text" size="4" id="sp_abbreviation" value="<?php echo $abbreviation; ?>">

View File

@@ -141,7 +141,7 @@ function sp_event_edit_columns() {
'cb' => '<input type="checkbox" />', 'cb' => '<input type="checkbox" />',
'title' => __( 'Event', 'sportspress' ), 'title' => __( 'Event', 'sportspress' ),
'sp_team' => __( 'Teams', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ),
'sp_league' => __( 'Leagues', 'sportspress' ), 'sp_season' => __( 'Seasons', 'sportspress' ),
'sp_kickoff' => __( 'Kick-off', 'sportspress' ) 'sp_kickoff' => __( 'Kick-off', 'sportspress' )
); );
return $columns; return $columns;

View File

@@ -25,7 +25,7 @@ function sp_list_edit_columns() {
'title' => __( 'Title' ), 'title' => __( 'Title' ),
'sp_player' => __( 'Players', 'sportspress' ), 'sp_player' => __( 'Players', 'sportspress' ),
'sp_team' => __( 'Teams', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ),
'sp_league' => __( 'Leagues', 'sportspress' ) 'sp_season' => __( 'Seasons', 'sportspress' )
); );
return $columns; return $columns;
} }
@@ -42,16 +42,16 @@ function sp_list_meta_init( $post ) {
} }
function sp_list_player_meta( $post ) { function sp_list_player_meta( $post ) {
$league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 ); $season_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 );
$team_id = get_post_meta( $post->ID, 'sp_team', true ); $team_id = get_post_meta( $post->ID, 'sp_team', true );
?> ?>
<div> <div>
<p class="sp-tab-select"> <p class="sp-tab-select">
<?php <?php
$args = array( $args = array(
'taxonomy' => 'sp_league', 'taxonomy' => 'sp_season',
'name' => 'sp_league', 'name' => 'sp_season',
'selected' => $league_id, 'selected' => $season_id,
'value' => 'term_id' 'value' => 'term_id'
); );
sp_dropdown_taxonomies( $args ); sp_dropdown_taxonomies( $args );

View File

@@ -21,7 +21,7 @@ add_action( 'init', 'sp_player_cpt_init' );
function sp_player_meta_init( $post ) { function sp_player_meta_init( $post ) {
$teams = (array)get_post_meta( $post->ID, 'sp_team', false ); $teams = (array)get_post_meta( $post->ID, 'sp_team', false );
$leagues = (array)get_the_terms( $post->ID, 'sp_league' ); $leagues = (array)get_the_terms( $post->ID, 'sp_season' );
remove_meta_box( 'submitdiv', 'sp_player', 'side' ); remove_meta_box( 'submitdiv', 'sp_player', 'side' );
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_player', 'side', 'high' ); add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_player', 'side', 'high' );
@@ -44,7 +44,7 @@ function sp_player_team_meta( $post ) {
function sp_player_stats_meta( $post ) { function sp_player_stats_meta( $post ) {
$team_ids = (array)get_post_meta( $post->ID, 'sp_team', false ); $team_ids = (array)get_post_meta( $post->ID, 'sp_team', false );
$leagues = (array)get_the_terms( $post->ID, 'sp_league' ); $leagues = (array)get_the_terms( $post->ID, 'sp_season' );
$stats = (array)get_post_meta( $post->ID, 'sp_statistics', true ); $stats = (array)get_post_meta( $post->ID, 'sp_statistics', true );
// Equation Operating System // Equation Operating System
@@ -110,7 +110,7 @@ function sp_player_stats_meta( $post ) {
), ),
'tax_query' => array( 'tax_query' => array(
array( array(
'taxonomy' => 'sp_league', 'taxonomy' => 'sp_season',
'field' => 'id', 'field' => 'id',
'terms' => $div_id 'terms' => $div_id
) )
@@ -182,7 +182,7 @@ function sp_player_edit_columns() {
'title' => __( 'Name', 'sportspress' ), 'title' => __( 'Name', 'sportspress' ),
'sp_position' => __( 'Positions', 'sportspress' ), 'sp_position' => __( 'Positions', 'sportspress' ),
'sp_team' => __( 'Teams', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ),
'sp_league' => __( 'Leagues', 'sportspress' ) 'sp_season' => __( 'Seasons', 'sportspress' )
); );
return $columns; return $columns;
} }

View File

@@ -43,7 +43,7 @@ function sp_staff_edit_columns() {
'title' => __( 'Name', 'sportspress' ), 'title' => __( 'Name', 'sportspress' ),
'sp_position' => __( 'Positions', 'sportspress' ), 'sp_position' => __( 'Positions', 'sportspress' ),
'sp_team' => __( 'Teams', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ),
'sp_league' => __( 'Leagues', 'sportspress' ), 'sp_season' => __( 'Seasons', 'sportspress' ),
); );
return $columns; return $columns;
} }

View File

@@ -37,7 +37,13 @@ function sp_statistic_meta_init() {
function sp_statistic_equation_meta( $post ) { function sp_statistic_equation_meta( $post ) {
$equation = explode( ' ', get_post_meta( $post->ID, 'sp_equation', true ) ); $equation = explode( ' ', get_post_meta( $post->ID, 'sp_equation', true ) );
$order = get_post_meta( $post->ID, 'sp_order', true );
$priority = get_post_meta( $post->ID, 'sp_priority', true );
$precision = get_post_meta( $post->ID, 'sp_precision', true );
$abbreviation = get_post_meta( $post->ID, 'sp_abbreviation', true ); $abbreviation = get_post_meta( $post->ID, 'sp_abbreviation', true );
// Defaults
if ( $precision == '' ) $precision = 1;
?> ?>
<p class="sp-equation-selector"> <p class="sp-equation-selector">
<?php <?php
@@ -46,6 +52,28 @@ function sp_statistic_equation_meta( $post ) {
endforeach; endforeach;
?> ?>
</p> </p>
<p><strong><?php _e( 'Sort Order', 'sportspress' ); ?></strong></p>
<p class="sp-order-selector">
<select name="sp_priority">
<?php
$options = array( '0' => __( 'Disable', 'sportspress' ), '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', );
foreach ( $options as $key => $value ):
printf( '<option value="%s" %s>%s</option>', $key, selected( true, $key == $priority, false ), $value );
endforeach;
?>
</select>
<select name="sp_order"<?php if ( ! $priority ): ?> disabled="disabled;"<?php endif; ?>>
<?php
$options = array( 'DESC' => __( 'Descending', 'sportspress' ), 'ASC' => __( 'Ascending', 'sportspress' ) );
foreach ( $options as $key => $value ):
printf( '<option value="%s" %s>%s</option>', $key, selected( true, $key == $order, false ), $value );
endforeach;
?>
</select>
<p><strong><?php _e( 'Precision', 'sportspress' ); ?></strong></p>
<p>
<input name="sp_precision" type="text" size="4" id="sp_precision" value="<?php echo $precision; ?>">
</p>
<p><strong><?php _e( 'Abbreviation', 'sportspress' ); ?></strong></p> <p><strong><?php _e( 'Abbreviation', 'sportspress' ); ?></strong></p>
<p> <p>
<input name="sp_abbreviation" type="text" size="4" id="sp_abbreviation" value="<?php echo $abbreviation; ?>"> <input name="sp_abbreviation" type="text" size="4" id="sp_abbreviation" value="<?php echo $abbreviation; ?>">

View File

@@ -24,7 +24,7 @@ function sp_table_edit_columns() {
'cb' => '<input type="checkbox" />', 'cb' => '<input type="checkbox" />',
'title' => __( 'Title' ), 'title' => __( 'Title' ),
'sp_team' => __( 'Teams', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ),
'sp_league' => __( 'Leagues', 'sportspress' ), 'sp_season' => __( 'Seasons', 'sportspress' ),
); );
return $columns; return $columns;
} }
@@ -41,14 +41,14 @@ function sp_table_meta_init( $post ) {
} }
function sp_table_team_meta( $post, $test ) { function sp_table_team_meta( $post, $test ) {
$league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 ); $league_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 );
?> ?>
<div> <div>
<p class="sp-tab-select"> <p class="sp-tab-select">
<?php <?php
$args = array( $args = array(
'taxonomy' => 'sp_league', 'taxonomy' => 'sp_season',
'name' => 'sp_league', 'name' => 'sp_season',
'selected' => $league_id, 'selected' => $league_id,
'value' => 'term_id' 'value' => 'term_id'
); );
@@ -56,7 +56,7 @@ function sp_table_team_meta( $post, $test ) {
?> ?>
</p> </p>
<?php <?php
sp_post_checklist( $post->ID, 'sp_team', 'block', 'sp_league' ); sp_post_checklist( $post->ID, 'sp_team', 'block', 'sp_season' );
sp_post_adder( 'sp_team' ); sp_post_adder( 'sp_team' );
?> ?>
</div> </div>

View File

@@ -20,7 +20,7 @@ function sp_team_cpt_init() {
add_action( 'init', 'sp_team_cpt_init' ); add_action( 'init', 'sp_team_cpt_init' );
function sp_team_meta_init( $post ) { function sp_team_meta_init( $post ) {
$leagues = (array)get_the_terms( $post->ID, 'sp_league' ); $leagues = (array)get_the_terms( $post->ID, 'sp_season' );
remove_meta_box( 'submitdiv', 'sp_team', 'side' ); remove_meta_box( 'submitdiv', 'sp_team', 'side' );
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_team', 'side', 'high' ); add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_team', 'side', 'high' );
@@ -37,14 +37,14 @@ function sp_team_edit_columns() {
'cb' => '<input type="checkbox" />', 'cb' => '<input type="checkbox" />',
'sp_logo' => '&nbsp;', 'sp_logo' => '&nbsp;',
'title' => __( 'Team', 'sportspress' ), 'title' => __( 'Team', 'sportspress' ),
'sp_league' => __( 'Leagues', 'sportspress' ) 'sp_season' => __( 'Seasons', 'sportspress' )
); );
return $columns; return $columns;
} }
add_filter( 'manage_edit-sp_team_columns', 'sp_team_edit_columns' ); add_filter( 'manage_edit-sp_team_columns', 'sp_team_edit_columns' );
function sp_team_columns_meta( $post ) { function sp_team_columns_meta( $post ) {
$leagues = (array)get_the_terms( $post->ID, 'sp_league' ); $leagues = (array)get_the_terms( $post->ID, 'sp_season' );
$columns = (array)get_post_meta( $post->ID, 'sp_columns', true ); $columns = (array)get_post_meta( $post->ID, 'sp_columns', true );
// Equation Operating System // Equation Operating System
@@ -98,7 +98,7 @@ function sp_team_columns_meta( $post ) {
), ),
'tax_query' => array( 'tax_query' => array(
array( array(
'taxonomy' => 'sp_league', 'taxonomy' => 'sp_season',
'field' => 'id', 'field' => 'id',
'terms' => $div_id 'terms' => $div_id
) )

View File

@@ -1,8 +1,8 @@
<?php <?php
function sp_league_term_init() { function sp_season_term_init() {
$name = __( 'Leagues', 'sportspress' ); $name = __( 'Seasons', 'sportspress' );
$singular_name = __( 'League', 'sportspress' ); $singular_name = __( 'Season', 'sportspress' );
$lowercase_name = __( 'leagues', 'sportspress' ); $lowercase_name = __( 'season', 'sportspress' );
$object_type = array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff' ); $object_type = array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff' );
$labels = sp_tax_labels( $name, $singular_name, $lowercase_name ); $labels = sp_tax_labels( $name, $singular_name, $lowercase_name );
$args = array( $args = array(
@@ -12,7 +12,7 @@ function sp_league_term_init() {
'hierarchical' => true, 'hierarchical' => true,
'rewrite' => array( 'slug' => 'league' ) 'rewrite' => array( 'slug' => 'league' )
); );
register_taxonomy( 'sp_league', $object_type, $args ); register_taxonomy( 'sp_season', $object_type, $args );
} }
add_action( 'init', 'sp_league_term_init' ); add_action( 'init', 'sp_season_term_init' );
?> ?>

View File

@@ -30,13 +30,13 @@ function sp_admin_menu( $position ) {
// Remove "Add Configuration" link under SportsPress // Remove "Add Configuration" link under SportsPress
unset( $submenu['edit.php?post_type=sp_config'][10] ); unset( $submenu['edit.php?post_type=sp_config'][10] );
// Remove "Leagues" link under Events // Remove "Seasons" link under Events
unset( $submenu['edit.php?post_type=sp_event'][15] ); unset( $submenu['edit.php?post_type=sp_event'][15] );
// Remove "Leagues" link under Players // Remove "Seasons" link under Players
unset( $submenu['edit.php?post_type=sp_player'][15] ); unset( $submenu['edit.php?post_type=sp_player'][15] );
// Remove "Leagues" link under Staff // Remove "Seasons" link under Staff
unset( $submenu['edit.php?post_type=sp_staff'][15] ); unset( $submenu['edit.php?post_type=sp_staff'][15] );
} }
add_action( 'admin_menu', 'sp_admin_menu' ); add_action( 'admin_menu', 'sp_admin_menu' );
@@ -108,8 +108,8 @@ function sp_manage_posts_custom_column( $column, $post_id ) {
case 'sp_event': case 'sp_event':
echo get_post_meta ( $post_id, 'sp_event' ) ? sizeof( get_post_meta ( $post_id, 'sp_event' ) ) : '—'; echo get_post_meta ( $post_id, 'sp_event' ) ? sizeof( get_post_meta ( $post_id, 'sp_event' ) ) : '—';
break; break;
case 'sp_league': case 'sp_season':
echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—'; echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—';
break; break;
case 'sp_sponsor': case 'sp_sponsor':
echo get_the_terms ( $post_id, 'sp_sponsor' ) ? the_terms( $post_id, 'sp_sponsor' ) : '—'; echo get_the_terms ( $post_id, 'sp_sponsor' ) ? the_terms( $post_id, 'sp_sponsor' ) : '—';
@@ -154,11 +154,11 @@ function sp_restrict_manage_posts() {
sp_dropdown_taxonomies( $args ); sp_dropdown_taxonomies( $args );
endif; endif;
if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_list' ) ) ): if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_list' ) ) ):
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null; $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
$args = array( $args = array(
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ), 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ),
'taxonomy' => 'sp_league', 'taxonomy' => 'sp_season',
'name' => 'sp_league', 'name' => 'sp_season',
'selected' => $selected 'selected' => $selected
); );
sp_dropdown_taxonomies( $args ); sp_dropdown_taxonomies( $args );
@@ -219,6 +219,13 @@ function sp_save_post( $post_id ) {
break; break;
case ( 'sp_result' ):
// Update abbreviation as string
update_post_meta( $post_id, 'sp_abbreviation', sp_array_value( $_POST, 'sp_abbreviation', '' ) );
break;
case ( 'sp_column' ): case ( 'sp_column' ):
// Update equation as string // Update equation as string
@@ -233,6 +240,9 @@ function sp_save_post( $post_id ) {
// Update abbreviation as string // Update abbreviation as string
update_post_meta( $post_id, 'sp_abbreviation', sp_array_value( $_POST, 'sp_abbreviation', '' ) ); update_post_meta( $post_id, 'sp_abbreviation', sp_array_value( $_POST, 'sp_abbreviation', '' ) );
// Update precision as integer
update_post_meta( $post_id, 'sp_precision', (int) sp_array_value( $_POST, 'sp_precision', 1 ) );
break; break;
case ( 'sp_statistic' ): case ( 'sp_statistic' ):
@@ -243,6 +253,9 @@ function sp_save_post( $post_id ) {
// Update abbreviation as string // Update abbreviation as string
update_post_meta( $post_id, 'sp_abbreviation', sp_array_value( $_POST, 'sp_abbreviation', '' ) ); update_post_meta( $post_id, 'sp_abbreviation', sp_array_value( $_POST, 'sp_abbreviation', '' ) );
// Update precision as integer
update_post_meta( $post_id, 'sp_precision', (int) sp_array_value( $_POST, 'sp_precision', 1 ) );
break; break;
case ( 'sp_player' ): case ( 'sp_player' ):
@@ -256,19 +269,41 @@ function sp_save_post( $post_id ) {
break; break;
case ( 'sp_staff' ): case ( 'sp_staff' ):
// Update team array
sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) ); sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
break; break;
case ( 'sp_table' ): case ( 'sp_table' ):
// Update teams array
update_post_meta( $post_id, 'sp_teams', sp_array_value( $_POST, 'sp_teams', array() ) ); update_post_meta( $post_id, 'sp_teams', sp_array_value( $_POST, 'sp_teams', array() ) );
wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_league', 0 ), 'sp_league' );
// Update season taxonomy
wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_season', 0 ), 'sp_season' );
// Update team array
sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) ); sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
break; break;
case ( 'sp_list' ): case ( 'sp_list' ):
// Update players array
update_post_meta( $post_id, 'sp_players', sp_array_value( $_POST, 'sp_players', array() ) ); update_post_meta( $post_id, 'sp_players', sp_array_value( $_POST, 'sp_players', array() ) );
// Update team array
update_post_meta( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', 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_league', 0 ), 'sp_league' );
// Update season taxonomy
wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_season', 0 ), 'sp_season' );
//Update player array
sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) ); sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) );
break; break;
endswitch; endswitch;
} }
add_action( 'save_post', 'sp_save_post' ); add_action( 'save_post', 'sp_save_post' );

View File

@@ -232,7 +232,7 @@ if ( !function_exists( 'sp_post_checklist' ) ) {
$parents = get_post_ancestors( $post ); $parents = get_post_ancestors( $post );
if ( $filter ): if ( $filter ):
$filter_values = (array)get_post_meta( $post->ID, $filter, false ); $filter_values = (array)get_post_meta( $post->ID, $filter, false );
$terms = (array)get_the_terms( $post->ID, 'sp_league' ); $terms = (array)get_the_terms( $post->ID, 'sp_season' );
foreach ( $terms as $term ): foreach ( $terms as $term ):
if ( is_object( $term ) && property_exists( $term, 'term_id' ) ) if ( is_object( $term ) && property_exists( $term, 'term_id' ) )
$filter_values[] = $term->term_id; $filter_values[] = $term->term_id;
@@ -447,7 +447,7 @@ if ( !function_exists( 'sp_league_table' ) ) {
$i = 0; $i = 0;
foreach ( $data as $team_id => $team_stats ): foreach ( $data as $team_id => $team_stats ):
if ( !$team_id ) continue; if ( !$team_id ) continue;
$div = get_term( $team_id, 'sp_league' ); $div = get_term( $team_id, 'sp_season' );
?> ?>
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>"> <tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
<td> <td>
@@ -487,7 +487,7 @@ if ( !function_exists( 'sp_player_table' ) ) {
$i = 0; $i = 0;
foreach ( $data as $player_id => $player_stats ): foreach ( $data as $player_id => $player_stats ):
if ( !$player_id ) continue; if ( !$player_id ) continue;
$div = get_term( $player_id, 'sp_league' ); $div = get_term( $player_id, 'sp_season' );
?> ?>
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>"> <tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
<td> <td>
@@ -516,7 +516,7 @@ if ( !function_exists( 'sp_team_columns_table' ) ) {
<table class="widefat sp-data-table"> <table class="widefat sp-data-table">
<thead> <thead>
<tr> <tr>
<th><?php _e( 'League', 'sportspress' ); ?></th> <th><?php _e( 'Season', 'sportspress' ); ?></th>
<?php foreach ( $columns as $label ): ?> <?php foreach ( $columns as $label ): ?>
<th><?php echo $label; ?></th> <th><?php echo $label; ?></th>
<?php endforeach; ?> <?php endforeach; ?>
@@ -528,13 +528,13 @@ if ( !function_exists( 'sp_team_columns_table' ) ) {
if ( empty( $data ) ): if ( empty( $data ) ):
?> ?>
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>"> <tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
<td><strong><?php printf( __( 'Select %s', 'sportspress' ), __( 'League', 'sportspress' ) ); ?></strong></td> <td><strong><?php printf( __( 'Select %s', 'sportspress' ), __( 'Season', 'sportspress' ) ); ?></strong></td>
</tr> </tr>
<?php <?php
else: else:
foreach ( $data as $div_id => $div_stats ): foreach ( $data as $div_id => $div_stats ):
if ( !$div_id ) continue; if ( !$div_id ) continue;
$div = get_term( $div_id, 'sp_league' ); $div = get_term( $div_id, 'sp_season' );
?> ?>
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>"> <tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
<td> <td>
@@ -564,7 +564,7 @@ if ( !function_exists( 'sp_player_statistics_table' ) ) {
<table class="widefat sp-data-table"> <table class="widefat sp-data-table">
<thead> <thead>
<tr> <tr>
<th><?php _e( 'League', 'sportspress' ); ?></th> <th><?php _e( 'Season', 'sportspress' ); ?></th>
<?php foreach ( $columns as $label ): ?> <?php foreach ( $columns as $label ): ?>
<th><?php echo $label; ?></th> <th><?php echo $label; ?></th>
<?php endforeach; ?> <?php endforeach; ?>
@@ -582,7 +582,7 @@ if ( !function_exists( 'sp_player_statistics_table' ) ) {
endif; endif;
foreach ( $team_stats as $div_id => $div_stats ): foreach ( $team_stats as $div_id => $div_stats ):
if ( !$div_id ) continue; if ( !$div_id ) continue;
$div = get_term( $div_id, 'sp_league' ); $div = get_term( $div_id, 'sp_season' );
?> ?>
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>"> <tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
<td> <td>
@@ -800,7 +800,7 @@ if ( !function_exists( 'sp_solve' ) ) {
if ( !function_exists( 'sp_get_table' ) ) { if ( !function_exists( 'sp_get_table' ) ) {
function sp_get_table( $post_id, $breakdown = false ) { function sp_get_table( $post_id, $breakdown = false ) {
$div_id = sp_get_the_term_id( $post_id, 'sp_league', 0 ); $div_id = sp_get_the_term_id( $post_id, 'sp_season', 0 );
$team_ids = (array)get_post_meta( $post_id, 'sp_team', false ); $team_ids = (array)get_post_meta( $post_id, 'sp_team', false );
$table_stats = (array)get_post_meta( $post_id, 'sp_teams', true ); $table_stats = (array)get_post_meta( $post_id, 'sp_teams', true );
@@ -857,7 +857,7 @@ if ( !function_exists( 'sp_get_table' ) ) {
'order' => 'ASC', 'order' => 'ASC',
'tax_query' => array( 'tax_query' => array(
array( array(
'taxonomy' => 'sp_league', 'taxonomy' => 'sp_season',
'field' => 'id', 'field' => 'id',
'terms' => $div_id 'terms' => $div_id
) )
@@ -1031,7 +1031,7 @@ if ( !function_exists( 'sp_get_table' ) ) {
if ( !function_exists( 'sp_get_list' ) ) { if ( !function_exists( 'sp_get_list' ) ) {
function sp_get_list( $post_id, $breakdown = false ) { function sp_get_list( $post_id, $breakdown = false ) {
$div_id = sp_get_the_term_id( $post_id, 'sp_league', 0 ); $div_id = sp_get_the_term_id( $post_id, 'sp_season', 0 );
$team_id = get_post_meta( $post_id, 'sp_team', true ); $team_id = get_post_meta( $post_id, 'sp_team', true );
$player_ids = (array)get_post_meta( $post_id, 'sp_player', false ); $player_ids = (array)get_post_meta( $post_id, 'sp_player', false );
$stats = (array)get_post_meta( $post_id, 'sp_players', true ); $stats = (array)get_post_meta( $post_id, 'sp_players', true );
@@ -1080,7 +1080,7 @@ if ( !function_exists( 'sp_get_list' ) ) {
'posts_per_page' => -1, 'posts_per_page' => -1,
'tax_query' => array( 'tax_query' => array(
array( array(
'taxonomy' => 'sp_league', 'taxonomy' => 'sp_season',
'field' => 'id', 'field' => 'id',
'terms' => $div_id 'terms' => $div_id
) )

View File

@@ -32,7 +32,8 @@ $sportspress_texts = array(
'Publish <b>immediately</b>' => __( 'Joined', 'sportspress' ) . ': <b>%1$s</b>' 'Publish <b>immediately</b>' => __( 'Joined', 'sportspress' ) . ': <b>%1$s</b>'
), ),
'sp_table' => array( 'sp_table' => array(
'Enter title here' => '' 'Enter title here' => '',
'Post updated. <a href=\"%s\">View post</a>' => 'test'
) )
); );

View File

@@ -47,7 +47,7 @@ require_once dirname( __FILE__ ) . '/admin/post-types/list.php';
require_once dirname( __FILE__ ) . '/admin/post-types/staff.php'; require_once dirname( __FILE__ ) . '/admin/post-types/staff.php';
// Terms // Terms
require_once dirname( __FILE__ ) . '/admin/terms/league.php'; require_once dirname( __FILE__ ) . '/admin/terms/season.php';
require_once dirname( __FILE__ ) . '/admin/terms/position.php'; require_once dirname( __FILE__ ) . '/admin/terms/position.php';
// Presets // Presets