Change div to league and pos to position
This commit is contained in:
@@ -142,7 +142,7 @@ function sp_event_edit_columns() {
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Event', 'sportspress' ),
|
||||
'sp_team' => __( 'Teams', 'sportspress' ),
|
||||
'sp_div' => __( 'Divisions', 'sportspress' ),
|
||||
'sp_league' => __( 'Leagues', 'sportspress' ),
|
||||
'sp_kickoff' => __( 'Kick-off', 'sportspress' )
|
||||
);
|
||||
return $columns;
|
||||
|
||||
@@ -24,7 +24,7 @@ function sp_list_edit_columns() {
|
||||
'title' => __( 'Title' ),
|
||||
'sp_player' => __( 'Players', 'sportspress' ),
|
||||
'sp_team' => __( 'Teams', 'sportspress' ),
|
||||
'sp_div' => __( 'Divisions', 'sportspress' )
|
||||
'sp_league' => __( 'Leagues', 'sportspress' )
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
@@ -41,17 +41,17 @@ function sp_list_meta_init( $post ) {
|
||||
}
|
||||
|
||||
function sp_list_player_meta( $post ) {
|
||||
$division_id = sp_get_the_term_id( $post->ID, 'sp_div', 0 );
|
||||
$league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 );
|
||||
$team_id = get_post_meta( $post->ID, 'sp_team', true );
|
||||
?>
|
||||
<div>
|
||||
<p class="sp-tab-select">
|
||||
<?php
|
||||
$args = array(
|
||||
'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Division', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_div',
|
||||
'name' => 'sp_div',
|
||||
'selected' => $division_id
|
||||
'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'League', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'selected' => $league_id
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
?>
|
||||
|
||||
@@ -20,7 +20,7 @@ add_action( 'init', 'sp_player_cpt_init' );
|
||||
|
||||
function sp_player_meta_init( $post ) {
|
||||
$teams = (array)get_post_meta( $post->ID, 'sp_team', false );
|
||||
$divisions = (array)get_the_terms( $post->ID, 'sp_div' );
|
||||
$leagues = (array)get_the_terms( $post->ID, 'sp_league' );
|
||||
|
||||
remove_meta_box( 'submitdiv', 'sp_player', 'side' );
|
||||
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_player', 'side', 'high' );
|
||||
@@ -28,7 +28,7 @@ function sp_player_meta_init( $post ) {
|
||||
add_meta_box( 'postimagediv', __( 'Photo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_player', 'side', 'high' );
|
||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_player_team_meta', 'sp_player', 'side', 'high' );
|
||||
|
||||
if ( $teams && $teams != array(0) && $divisions && $divisions != array(0) ):
|
||||
if ( $teams && $teams != array(0) && $leagues && $leagues != array(0) ):
|
||||
add_meta_box( 'sp_statsdiv', __( 'Statistics', 'sportspress' ), 'sp_player_stats_meta', 'sp_player', 'normal', 'high' );
|
||||
endif;
|
||||
|
||||
@@ -43,7 +43,7 @@ function sp_player_team_meta( $post ) {
|
||||
|
||||
function sp_player_stats_meta( $post ) {
|
||||
$team_ids = (array)get_post_meta( $post->ID, 'sp_team', false );
|
||||
$divisions = (array)get_the_terms( $post->ID, 'sp_div' );
|
||||
$leagues = (array)get_the_terms( $post->ID, 'sp_league' );
|
||||
$stats = (array)get_post_meta( $post->ID, 'sp_metrics', true );
|
||||
|
||||
// Equation Operating System
|
||||
@@ -52,9 +52,9 @@ function sp_player_stats_meta( $post ) {
|
||||
// Get labels from metric variables
|
||||
$metric_labels = (array)sp_get_var_labels( 'sp_metric' );
|
||||
|
||||
// Generate array of all division ids
|
||||
// Generate array of all league ids
|
||||
$div_ids = array();
|
||||
foreach ( $divisions as $key => $value ):
|
||||
foreach ( $leagues as $key => $value ):
|
||||
if ( is_object( $value ) && property_exists( $value, 'term_id' ) )
|
||||
$div_ids[] = $value->term_id;
|
||||
endforeach;
|
||||
@@ -78,7 +78,7 @@ function sp_player_stats_meta( $post ) {
|
||||
|
||||
$data = array();
|
||||
|
||||
// Get all divisions populated with stats where available
|
||||
// Get all leagues populated with stats where available
|
||||
$data[ $team_id ] = sp_array_combine( $div_ids, $stats[ $team_id ] );
|
||||
|
||||
// Get equations from statistics variables
|
||||
@@ -109,7 +109,7 @@ function sp_player_stats_meta( $post ) {
|
||||
),
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'sp_div',
|
||||
'taxonomy' => 'sp_league',
|
||||
'field' => 'id',
|
||||
'terms' => $div_id
|
||||
)
|
||||
@@ -133,7 +133,7 @@ function sp_player_stats_meta( $post ) {
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
// Generate array of placeholder values for each division
|
||||
// Generate array of placeholder values for each league
|
||||
$placeholders[ $team_id ][ $div_id ] = array();
|
||||
foreach ( $equations as $key => $value ):
|
||||
|
||||
@@ -175,9 +175,9 @@ function sp_player_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Name', 'sportspress' ),
|
||||
'sp_pos' => __( 'Positions', 'sportspress' ),
|
||||
'sp_position' => __( 'Positions', 'sportspress' ),
|
||||
'sp_team' => __( 'Teams', 'sportspress' ),
|
||||
'sp_div' => __( 'Divisions', 'sportspress' )
|
||||
'sp_league' => __( 'Leagues', 'sportspress' )
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ function sp_staff_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Name', 'sportspress' ),
|
||||
'sp_pos' => __( 'Positions', 'sportspress' ),
|
||||
'sp_position' => __( 'Positions', 'sportspress' ),
|
||||
'sp_team' => __( 'Teams', 'sportspress' ),
|
||||
'sp_div' => __( 'Divisions', 'sportspress' ),
|
||||
'sp_league' => __( 'Leagues', 'sportspress' ),
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ function sp_table_edit_columns() {
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Title' ),
|
||||
'sp_team' => __( 'Teams', 'sportspress' ),
|
||||
'sp_div' => __( 'Divisions', 'sportspress' ),
|
||||
'sp_league' => __( 'Leagues', 'sportspress' ),
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
@@ -40,22 +40,22 @@ function sp_table_meta_init( $post ) {
|
||||
}
|
||||
|
||||
function sp_table_team_meta( $post, $test ) {
|
||||
$division_id = sp_get_the_term_id( $post->ID, 'sp_div', 0 );
|
||||
$league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 );
|
||||
?>
|
||||
<div>
|
||||
<p class="sp-tab-select">
|
||||
<?php
|
||||
$args = array(
|
||||
'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Division', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_div',
|
||||
'name' => 'sp_div',
|
||||
'selected' => $division_id
|
||||
'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'League', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'selected' => $league_id
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
sp_post_checklist( $post->ID, 'sp_team', 'block', 'sp_div' );
|
||||
sp_post_checklist( $post->ID, 'sp_team', 'block', 'sp_league' );
|
||||
sp_post_adder( 'sp_team' );
|
||||
?>
|
||||
</div>
|
||||
|
||||
@@ -19,14 +19,14 @@ function sp_team_cpt_init() {
|
||||
add_action( 'init', 'sp_team_cpt_init' );
|
||||
|
||||
function sp_team_meta_init( $post ) {
|
||||
$divisions = (array)get_the_terms( $post->ID, 'sp_div' );
|
||||
$leagues = (array)get_the_terms( $post->ID, 'sp_league' );
|
||||
|
||||
remove_meta_box( 'submitdiv', 'sp_team', 'side' );
|
||||
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_team', 'side', 'high' );
|
||||
remove_meta_box( 'postimagediv', 'sp_team', 'side' );
|
||||
add_meta_box( 'postimagediv', __( 'Logo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_team', 'side', 'high' );
|
||||
|
||||
if ( $divisions && $divisions != array(0) ):
|
||||
if ( $leagues && $leagues != array(0) ):
|
||||
add_meta_box( 'sp_statsdiv', __( 'Statistics', 'sportspress' ), 'sp_team_stats_meta', 'sp_team', 'normal', 'high' );
|
||||
endif;
|
||||
}
|
||||
@@ -36,14 +36,14 @@ function sp_team_edit_columns() {
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'sp_logo' => ' ',
|
||||
'title' => __( 'Team', 'sportspress' ),
|
||||
'sp_div' => __( 'Divisions', 'sportspress' )
|
||||
'sp_league' => __( 'Leagues', '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_div' );
|
||||
$leagues = (array)get_the_terms( $post->ID, 'sp_league' );
|
||||
$stats = (array)get_post_meta( $post->ID, 'sp_stats', true );
|
||||
|
||||
// Equation Operating System
|
||||
@@ -55,14 +55,14 @@ function sp_team_stats_meta( $post ) {
|
||||
// Get labels from outcome variables
|
||||
$outcome_labels = (array)sp_get_var_labels( 'sp_outcome' );
|
||||
|
||||
// Generate array of all division ids
|
||||
// Generate array of all league ids
|
||||
$div_ids = array();
|
||||
foreach ( $divisions as $key => $value ):
|
||||
foreach ( $leagues as $key => $value ):
|
||||
if ( is_object( $value ) && property_exists( $value, 'term_id' ) )
|
||||
$div_ids[] = $value->term_id;
|
||||
endforeach;
|
||||
|
||||
// Get all divisions populated with stats where available
|
||||
// Get all leagues populated with stats where available
|
||||
$data = sp_array_combine( $div_ids, $stats );
|
||||
|
||||
// Get equations from statistics variables
|
||||
@@ -96,7 +96,7 @@ function sp_team_stats_meta( $post ) {
|
||||
),
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'sp_div',
|
||||
'taxonomy' => 'sp_league',
|
||||
'field' => 'id',
|
||||
'terms' => $div_id
|
||||
)
|
||||
@@ -130,7 +130,7 @@ function sp_team_stats_meta( $post ) {
|
||||
endforeach;
|
||||
endforeach;
|
||||
|
||||
// Generate array of placeholder values for each division
|
||||
// Generate array of placeholder values for each league
|
||||
$placeholders[ $div_id ] = array();
|
||||
foreach ( $equations as $key => $value ):
|
||||
$placeholders[ $div_id ][ $key ] = $eos->solveIF( str_replace( ' ', '', $value ), $totals );
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
function sp_div_term_init() {
|
||||
$name = __( 'Divisions', 'sportspress' );
|
||||
$singular_name = __( 'Division', 'sportspress' );
|
||||
$lowercase_name = __( 'divisions', 'sportspress' );
|
||||
$object_type = array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff' );
|
||||
$labels = sp_tax_labels( $name, $singular_name, $lowercase_name );
|
||||
$args = array(
|
||||
'label' => $name,
|
||||
'labels' => $labels,
|
||||
'public' => true,
|
||||
'hierarchical' => true,
|
||||
'rewrite' => array( 'slug' => 'division' )
|
||||
);
|
||||
register_taxonomy( 'sp_div', $object_type, $args );
|
||||
}
|
||||
add_action( 'init', 'sp_div_term_init' );
|
||||
?>
|
||||
18
admin/terms/league.php
Normal file
18
admin/terms/league.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
function sp_league_term_init() {
|
||||
$name = __( 'Leagues', 'sportspress' );
|
||||
$singular_name = __( 'League', 'sportspress' );
|
||||
$lowercase_name = __( 'leagues', 'sportspress' );
|
||||
$object_type = array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff' );
|
||||
$labels = sp_tax_labels( $name, $singular_name, $lowercase_name );
|
||||
$args = array(
|
||||
'label' => $name,
|
||||
'labels' => $labels,
|
||||
'public' => true,
|
||||
'hierarchical' => true,
|
||||
'rewrite' => array( 'slug' => 'league' )
|
||||
);
|
||||
register_taxonomy( 'sp_league', $object_type, $args );
|
||||
}
|
||||
add_action( 'init', 'sp_league_term_init' );
|
||||
?>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
function sp_pos_term_init() {
|
||||
function sp_position_term_init() {
|
||||
$name = __( 'Positions', 'sportspress' );
|
||||
$singular_name = __( 'Position', 'sportspress' );
|
||||
$lowercase_name = __( 'position', 'sportspress' );
|
||||
@@ -12,9 +12,9 @@ function sp_pos_term_init() {
|
||||
'hierarchical' => true,
|
||||
'rewrite' => array( 'slug' => 'position' )
|
||||
);
|
||||
register_taxonomy( 'sp_pos', $object_type, $args );
|
||||
register_taxonomy_for_object_type( 'sp_pos', 'sp_player' );
|
||||
register_taxonomy_for_object_type( 'sp_pos', 'sp_staff' );
|
||||
register_taxonomy( 'sp_position', $object_type, $args );
|
||||
register_taxonomy_for_object_type( 'sp_position', 'sp_player' );
|
||||
register_taxonomy_for_object_type( 'sp_position', 'sp_staff' );
|
||||
}
|
||||
add_action( 'init', 'sp_pos_term_init' );
|
||||
add_action( 'init', 'sp_position_term_init' );
|
||||
?>
|
||||
@@ -7,7 +7,7 @@ function sp_table_shortcode( $atts, $content = null, $code = "" ) {
|
||||
'div' => 0
|
||||
), $atts ) );
|
||||
|
||||
// Get all teams in the division
|
||||
// Get all teams in the league
|
||||
$args = array(
|
||||
'post_type' => 'sp_team',
|
||||
'numberposts' => -1,
|
||||
@@ -16,7 +16,7 @@ function sp_table_shortcode( $atts, $content = null, $code = "" ) {
|
||||
);
|
||||
if ( $div ) {
|
||||
$args['tax_query'][] = array(
|
||||
'taxonomy' => 'sp_div',
|
||||
'taxonomy' => 'sp_league',
|
||||
'terms' => $div,
|
||||
'field' => 'term_id'
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== SportsPress ===
|
||||
Contributors: themeboy
|
||||
Tags: sports, sports journalism, teams, team management, fixtures, results, standings, league tables, divisions, reporting, themeboy, wordpress sports, configurable
|
||||
Tags: sports, sports journalism, teams, team management, fixtures, results, standings, league tables, leagues, reporting, themeboy, wordpress sports, configurable
|
||||
Requires at least: 3.5
|
||||
Tested up to: 3.6
|
||||
Stable tag: 0.1.2
|
||||
|
||||
@@ -22,13 +22,13 @@ function sp_admin_menu() {
|
||||
// Remove "Add Event" link under Events
|
||||
unset( $submenu['edit.php?post_type=sp_event'][10] );
|
||||
|
||||
// Remove "Divisions" link under Events
|
||||
// Remove "Leagues" link under Events
|
||||
unset( $submenu['edit.php?post_type=sp_event'][15] );
|
||||
|
||||
// Remove "Divisions" link under Players
|
||||
// Remove "Leagues" link under Players
|
||||
unset( $submenu['edit.php?post_type=sp_player'][15] );
|
||||
|
||||
// Remove "Divisions" link under Staff
|
||||
// Remove "Leagues" link under Staff
|
||||
unset( $submenu['edit.php?post_type=sp_staff'][15] );
|
||||
}
|
||||
add_action( 'admin_menu', 'sp_admin_menu' );
|
||||
@@ -39,8 +39,8 @@ function sp_manage_posts_custom_column( $column, $post_id ) {
|
||||
case 'sp_logo':
|
||||
edit_post_link( get_the_post_thumbnail( $post_id, 'sp_icon' ), '', '', $post_id );
|
||||
break;
|
||||
case 'sp_pos':
|
||||
echo get_the_terms ( $post_id, 'sp_pos' ) ? the_terms( $post_id, 'sp_pos' ) : '—';
|
||||
case 'sp_position':
|
||||
echo get_the_terms ( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : '—';
|
||||
break;
|
||||
case 'sp_team':
|
||||
$result = get_post_meta( $post_id, 'sp_result', false );
|
||||
@@ -71,8 +71,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_div':
|
||||
echo get_the_terms ( $post_id, 'sp_div' ) ? the_terms( $post_id, 'sp_div' ) : '—';
|
||||
case 'sp_league':
|
||||
echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—';
|
||||
break;
|
||||
case 'sp_sponsor':
|
||||
echo get_the_terms ( $post_id, 'sp_sponsor' ) ? the_terms( $post_id, 'sp_sponsor' ) : '—';
|
||||
@@ -101,21 +101,21 @@ function sp_restrict_manage_posts() {
|
||||
// wp_dropdown_pages( $args );
|
||||
endif;
|
||||
if ( in_array( $typenow, array( 'sp_player', 'sp_staff' ) ) ):
|
||||
$selected = isset( $_REQUEST['sp_pos'] ) ? $_REQUEST['sp_pos'] : null;
|
||||
$selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_pos',
|
||||
'name' => 'sp_pos',
|
||||
'taxonomy' => 'sp_position',
|
||||
'name' => 'sp_position',
|
||||
'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_div'] ) ? $_REQUEST['sp_div'] : null;
|
||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Divisions', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_div',
|
||||
'name' => 'sp_div',
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
@@ -208,13 +208,13 @@ function sp_save_post( $post_id ) {
|
||||
break;
|
||||
case ( 'sp_table' ):
|
||||
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_div', 0 ), 'sp_div' );
|
||||
wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_league', 0 ), 'sp_league' );
|
||||
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_players', sp_array_value( $_POST, 'sp_players', 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_div', 0 ), 'sp_div' );
|
||||
wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_league', 0 ), 'sp_league' );
|
||||
sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) );
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
@@ -243,7 +243,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_div' );
|
||||
$terms = (array)get_the_terms( $post->ID, 'sp_league' );
|
||||
foreach ( $terms as $term ):
|
||||
if ( is_object( $term ) && property_exists( $term, 'term_id' ) )
|
||||
$filter_values[] = $term->term_id;
|
||||
@@ -457,7 +457,7 @@ if ( !function_exists( 'sp_league_table' ) ) {
|
||||
$i = 0;
|
||||
foreach ( $data as $team_id => $team_stats ):
|
||||
if ( !$team_id ) continue;
|
||||
$div = get_term( $team_id, 'sp_div' );
|
||||
$div = get_term( $team_id, 'sp_league' );
|
||||
?>
|
||||
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
||||
<td>
|
||||
@@ -497,7 +497,7 @@ if ( !function_exists( 'sp_player_table' ) ) {
|
||||
$i = 0;
|
||||
foreach ( $data as $player_id => $player_stats ):
|
||||
if ( !$player_id ) continue;
|
||||
$div = get_term( $player_id, 'sp_div' );
|
||||
$div = get_term( $player_id, 'sp_league' );
|
||||
?>
|
||||
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
||||
<td>
|
||||
@@ -526,7 +526,7 @@ if ( !function_exists( 'sp_team_stats_table' ) ) {
|
||||
<table class="widefat sp-data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php _e( 'Division', 'sportspress' ); ?></th>
|
||||
<th><?php _e( 'League', 'sportspress' ); ?></th>
|
||||
<?php foreach ( $columns as $label ): ?>
|
||||
<th><?php echo $label; ?></th>
|
||||
<?php endforeach; ?>
|
||||
@@ -538,13 +538,13 @@ if ( !function_exists( 'sp_team_stats_table' ) ) {
|
||||
if ( empty( $data ) ):
|
||||
?>
|
||||
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
||||
<td><strong><?php printf( __( 'Select %s', 'sportspress' ), __( 'Division', 'sportspress' ) ); ?></strong></td>
|
||||
<td><strong><?php printf( __( 'Select %s', 'sportspress' ), __( 'League', 'sportspress' ) ); ?></strong></td>
|
||||
</tr>
|
||||
<?php
|
||||
else:
|
||||
foreach ( $data as $div_id => $div_stats ):
|
||||
if ( !$div_id ) continue;
|
||||
$div = get_term( $div_id, 'sp_div' );
|
||||
$div = get_term( $div_id, 'sp_league' );
|
||||
?>
|
||||
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
||||
<td>
|
||||
@@ -574,7 +574,7 @@ if ( !function_exists( 'sp_player_metrics_table' ) ) {
|
||||
<table class="widefat sp-data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php _e( 'Division', 'sportspress' ); ?></th>
|
||||
<th><?php _e( 'League', 'sportspress' ); ?></th>
|
||||
<?php foreach ( $columns as $label ): ?>
|
||||
<th><?php echo $label; ?></th>
|
||||
<?php endforeach; ?>
|
||||
@@ -592,7 +592,7 @@ if ( !function_exists( 'sp_player_metrics_table' ) ) {
|
||||
endif;
|
||||
foreach ( $team_stats as $div_id => $div_stats ):
|
||||
if ( !$div_id ) continue;
|
||||
$div = get_term( $div_id, 'sp_div' );
|
||||
$div = get_term( $div_id, 'sp_league' );
|
||||
?>
|
||||
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
||||
<td>
|
||||
@@ -777,7 +777,7 @@ if ( !function_exists( 'sportspress_render_option_field' ) ) {
|
||||
|
||||
if ( !function_exists( 'sp_get_table' ) ) {
|
||||
function sp_get_table( $post_id, $breakdown = false ) {
|
||||
$div_id = sp_get_the_term_id( $post_id, 'sp_div', 0 );
|
||||
$div_id = sp_get_the_term_id( $post_id, 'sp_league', 0 );
|
||||
$team_ids = (array)get_post_meta( $post_id, 'sp_team', false );
|
||||
$table_stats = (array)get_post_meta( $post_id, 'sp_teams', true );
|
||||
|
||||
@@ -790,7 +790,7 @@ if ( !function_exists( 'sp_get_table' ) ) {
|
||||
// Get labels from outcome variables
|
||||
$outcome_labels = (array)sp_get_var_labels( 'sp_outcome' );
|
||||
|
||||
// Get all divisions populated with stats where available
|
||||
// Get all leagues populated with stats where available
|
||||
$tempdata = sp_array_combine( $team_ids, $table_stats );
|
||||
|
||||
// Create entry for each team in totals
|
||||
@@ -831,7 +831,7 @@ if ( !function_exists( 'sp_get_table' ) ) {
|
||||
'posts_per_page' => -1,
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'sp_div',
|
||||
'taxonomy' => 'sp_league',
|
||||
'field' => 'id',
|
||||
'terms' => $div_id
|
||||
)
|
||||
@@ -978,7 +978,7 @@ if ( !function_exists( 'sp_get_table' ) ) {
|
||||
|
||||
if ( !function_exists( 'sp_get_list' ) ) {
|
||||
function sp_get_list( $post_id, $breakdown = false ) {
|
||||
$div_id = sp_get_the_term_id( $post_id, 'sp_div', 0 );
|
||||
$div_id = sp_get_the_term_id( $post_id, 'sp_league', 0 );
|
||||
$team_id = get_post_meta( $post_id, 'sp_team', true );
|
||||
$player_ids = (array)get_post_meta( $post_id, 'sp_player', false );
|
||||
$stats = (array)get_post_meta( $post_id, 'sp_players', true );
|
||||
@@ -989,7 +989,7 @@ if ( !function_exists( 'sp_get_list' ) ) {
|
||||
// Get labels from result variables
|
||||
$columns = (array)sp_get_var_labels( 'sp_metric' );
|
||||
|
||||
// Get all divisions populated with stats where available
|
||||
// Get all leagues populated with stats where available
|
||||
$tempdata = sp_array_combine( $player_ids, $stats );
|
||||
|
||||
// Get equations from statistics variables
|
||||
@@ -1027,7 +1027,7 @@ if ( !function_exists( 'sp_get_list' ) ) {
|
||||
'posts_per_page' => -1,
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'sp_div',
|
||||
'taxonomy' => 'sp_league',
|
||||
'field' => 'id',
|
||||
'terms' => $div_id
|
||||
)
|
||||
|
||||
@@ -46,8 +46,8 @@ require_once dirname( __FILE__ ) . '/admin/post-types/list.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/staff.php';
|
||||
|
||||
// Terms
|
||||
require_once dirname( __FILE__ ) . '/admin/terms/div.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/terms/pos.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/terms/league.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/terms/position.php';
|
||||
|
||||
// Shortcodes
|
||||
// require_once dirname( __FILE__ ) . '/classes/shortcodes/table.php';
|
||||
|
||||
Reference in New Issue
Block a user