Change league to division and remove sponsors
This commit is contained in:
22
list.php
22
list.php
@@ -24,7 +24,7 @@ function sp_list_edit_columns() {
|
||||
'title' => __( 'Title' ),
|
||||
'sp_player' => __( 'Players', 'sportspress' ),
|
||||
'sp_team' => __( 'Teams', 'sportspress' ),
|
||||
'sp_league' => __( 'Leagues', 'sportspress' )
|
||||
'sp_division' => __( 'Divisions', 'sportspress' )
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
@@ -36,17 +36,17 @@ function sp_list_meta_init() {
|
||||
}
|
||||
|
||||
function sp_list_player_meta( $post ) {
|
||||
$league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 );
|
||||
$division_id = sp_get_the_term_id( $post->ID, 'sp_division', 0 );
|
||||
$team_id = get_post_meta( $post->ID, 'sp_team', true );
|
||||
?>
|
||||
<div>
|
||||
<p class="sp-tab-select">
|
||||
<?php
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'selected' => $league_id
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Divisions', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_division',
|
||||
'name' => 'sp_division',
|
||||
'selected' => $division_id
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
?>
|
||||
@@ -75,9 +75,9 @@ 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 );
|
||||
$league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 );
|
||||
$division_id = sp_get_the_term_id( $post->ID, 'sp_division', 0 );
|
||||
$team_id = get_post_meta( $post->ID, 'sp_team', true );
|
||||
$data = sp_array_combine( $players, sp_array_value( $stats, $league_id, array() ) );
|
||||
$data = sp_array_combine( $players, sp_array_value( $stats, $division_id, array() ) );
|
||||
|
||||
// Generate array of placeholder values for each player
|
||||
$placeholders = array();
|
||||
@@ -92,9 +92,9 @@ function sp_list_stats_meta( $post ) {
|
||||
),
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'sp_league',
|
||||
'taxonomy' => 'sp_division',
|
||||
'field' => 'id',
|
||||
'terms' => $league_id
|
||||
'terms' => $division_id
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -108,6 +108,6 @@ function sp_list_stats_meta( $post ) {
|
||||
// Add first column label
|
||||
array_unshift( $columns, __( 'Player', 'sportspress' ) );
|
||||
|
||||
sp_stats_table( $data, $placeholders, $league_id, $columns, false );
|
||||
sp_stats_table( $data, $placeholders, $division_id, $columns, false );
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user