Fix styles and functions to align with theme
This commit is contained in:
@@ -24,6 +24,9 @@ function sportspress_admin_menu( $position ) {
|
|||||||
$menu[ $position ] = array( '', 'read', 'separator-sportspress', '', 'wp-menu-separator sportspress' );
|
$menu[ $position ] = array( '', 'read', 'separator-sportspress', '', 'wp-menu-separator sportspress' );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
// Remove "Positions" link from Media submenu
|
||||||
|
unset( $submenu['upload.php'][17] );
|
||||||
|
|
||||||
// Remove "Leagues" link from Players submenu
|
// Remove "Leagues" link from Players submenu
|
||||||
unset( $submenu['edit.php?post_type=sp_player'][15] );
|
unset( $submenu['edit.php?post_type=sp_player'][15] );
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
function sportspress_manage_posts_custom_column( $column, $post_id ) {
|
function sportspress_manage_posts_custom_column( $column, $post_id ) {
|
||||||
global $post;
|
global $post;
|
||||||
switch ( $column ):
|
switch ( $column ):
|
||||||
case 'sp_logo':
|
case 'sp_icon':
|
||||||
edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-icon' ), '', '', $post_id );
|
edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-icon' ), '', '', $post_id );
|
||||||
break;
|
break;
|
||||||
case 'sp_position':
|
case 'sp_position':
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ function sportspress_sanitize_title( $title ) {
|
|||||||
|
|
||||||
return $title;
|
return $title;
|
||||||
|
|
||||||
elseif ( isset( $_POST ) && array_key_exists( 'post_type', $_POST ) && in_array( $_POST['post_type'], array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_statistic' ) ) ):
|
elseif ( isset( $_POST ) && array_key_exists( 'post_type', $_POST ) && in_array( $_POST['post_type'], array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_statistic', 'sp_metric' ) ) ):
|
||||||
|
|
||||||
$key = $_POST['sp_key'];
|
$key = $_POST['sp_key'];
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,25 @@ function sportspress_save_post( $post_id ) {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ( 'sp_metric' ):
|
||||||
|
|
||||||
|
// Update format as string
|
||||||
|
update_post_meta( $post_id, 'sp_format', sportspress_array_value( $_POST, 'sp_format', 'integer' ) );
|
||||||
|
|
||||||
|
// Update precision as integer
|
||||||
|
update_post_meta( $post_id, 'sp_precision', (int) sportspress_array_value( $_POST, 'sp_precision', 1 ) );
|
||||||
|
|
||||||
|
// Update equation as string
|
||||||
|
update_post_meta( $post_id, 'sp_equation', implode( ' ', sportspress_array_value( $_POST, 'sp_equation', array() ) ) );
|
||||||
|
|
||||||
|
// Update sort order as string
|
||||||
|
update_post_meta( $post_id, 'sp_priority', sportspress_array_value( $_POST, 'sp_priority', '0' ) );
|
||||||
|
|
||||||
|
// Update sort order as string
|
||||||
|
update_post_meta( $post_id, 'sp_order', sportspress_array_value( $_POST, 'sp_order', 'DESC' ) );
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case ( 'sp_result' ):
|
case ( 'sp_result' ):
|
||||||
|
|
||||||
// Update format as string
|
// Update format as string
|
||||||
@@ -100,6 +119,9 @@ function sportspress_save_post( $post_id ) {
|
|||||||
// Update player number
|
// Update player number
|
||||||
update_post_meta( $post_id, 'sp_number', sportspress_array_value( $_POST, 'sp_number', '' ) );
|
update_post_meta( $post_id, 'sp_number', sportspress_array_value( $_POST, 'sp_number', '' ) );
|
||||||
|
|
||||||
|
// Update current team
|
||||||
|
update_post_meta( $post_id, 'sp_current_team', sportspress_array_value( $_POST, 'sp_current_team', '' ) );
|
||||||
|
|
||||||
// Update nationality
|
// Update nationality
|
||||||
update_post_meta( $post_id, 'sp_nationality', sportspress_array_value( $_POST, 'sp_nationality', '' ) );
|
update_post_meta( $post_id, 'sp_nationality', sportspress_array_value( $_POST, 'sp_nationality', '' ) );
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ add_action( 'init', 'sportspress_player_post_init' );
|
|||||||
function sportspress_player_edit_columns() {
|
function sportspress_player_edit_columns() {
|
||||||
$columns = array(
|
$columns = array(
|
||||||
'cb' => '<input type="checkbox" />',
|
'cb' => '<input type="checkbox" />',
|
||||||
|
'sp_icon' => ' ',
|
||||||
'title' => __( 'Name', 'sportspress' ),
|
'title' => __( 'Name', 'sportspress' ),
|
||||||
'sp_position' => __( 'Positions', 'sportspress' ),
|
'sp_position' => __( 'Positions', 'sportspress' ),
|
||||||
'sp_team' => __( 'Teams', 'sportspress' ),
|
'sp_team' => __( 'Teams', 'sportspress' ),
|
||||||
@@ -39,7 +40,7 @@ function sportspress_player_meta_init( $post ) {
|
|||||||
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' );
|
||||||
remove_meta_box( 'postimagediv', 'sp_player', 'side' );
|
remove_meta_box( 'postimagediv', 'sp_player', 'side' );
|
||||||
add_meta_box( 'postimagediv', __( 'Photo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_player', 'side', 'high' );
|
add_meta_box( 'postimagediv', __( 'Photo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_player', 'side', 'low' );
|
||||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_player_details_meta', 'sp_player', 'side', 'high' );
|
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_player_details_meta', 'sp_player', 'side', 'high' );
|
||||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_player_team_meta', 'sp_player', 'side', 'high' );
|
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_player_team_meta', 'sp_player', 'side', 'high' );
|
||||||
|
|
||||||
@@ -64,6 +65,8 @@ function sportspress_player_details_meta( $post ) {
|
|||||||
|
|
||||||
$number = get_post_meta( $post->ID, 'sp_number', true );
|
$number = get_post_meta( $post->ID, 'sp_number', true );
|
||||||
$nationality = get_post_meta( $post->ID, 'sp_nationality', true );
|
$nationality = get_post_meta( $post->ID, 'sp_nationality', true );
|
||||||
|
$teams = array_filter( get_post_meta( $post->ID, 'sp_team', false ) );
|
||||||
|
$current_team = get_post_meta( $post->ID, 'sp_current_team', true );
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
<strong><?php _e( 'Number', 'sportspress' ); ?></strong>
|
<strong><?php _e( 'Number', 'sportspress' ); ?></strong>
|
||||||
@@ -87,6 +90,20 @@ function sportspress_player_details_meta( $post ) {
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
|
<?php if ( $teams ): ?>
|
||||||
|
<p>
|
||||||
|
<strong><?php _e( 'Current Team', 'sportspress' ); ?></strong>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<select id="sp_current_team" name="sp_current_team">
|
||||||
|
<?php foreach ( $teams as $team ): ?>
|
||||||
|
<option value="<?php echo $team; ?>" <?php selected ( $current_team, $team ); ?>>
|
||||||
|
<?php echo get_the_title( $team ); ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ function sportspress_staff_meta_init() {
|
|||||||
remove_meta_box( 'submitdiv', 'sp_staff', 'side' );
|
remove_meta_box( 'submitdiv', 'sp_staff', 'side' );
|
||||||
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_staff', 'side', 'high' );
|
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_staff', 'side', 'high' );
|
||||||
remove_meta_box( 'postimagediv', 'sp_staff', 'side' );
|
remove_meta_box( 'postimagediv', 'sp_staff', 'side' );
|
||||||
add_meta_box( 'postimagediv', __( 'Photo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_staff', 'side', 'high' );
|
add_meta_box( 'postimagediv', __( 'Photo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_staff', 'side', 'low' );
|
||||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_staff_team_meta', 'sp_staff', 'side', 'high' );
|
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_staff_team_meta', 'sp_staff', 'side', 'high' );
|
||||||
add_meta_box( 'sp_profilediv', __( 'Profile' ), 'sportspress_staff_profile_meta', 'sp_staff', 'normal', 'high' );
|
add_meta_box( 'sp_profilediv', __( 'Profile' ), 'sportspress_staff_profile_meta', 'sp_staff', 'normal', 'high' );
|
||||||
}
|
}
|
||||||
@@ -40,6 +40,7 @@ function sportspress_staff_profile_meta( $post ) {
|
|||||||
function sportspress_staff_edit_columns() {
|
function sportspress_staff_edit_columns() {
|
||||||
$columns = array(
|
$columns = array(
|
||||||
'cb' => '<input type="checkbox" />',
|
'cb' => '<input type="checkbox" />',
|
||||||
|
'sp_icon' => ' ',
|
||||||
'title' => __( 'Name', 'sportspress' ),
|
'title' => __( 'Name', 'sportspress' ),
|
||||||
'sp_position' => __( 'Positions', 'sportspress' ),
|
'sp_position' => __( 'Positions', 'sportspress' ),
|
||||||
'sp_team' => __( 'Teams', 'sportspress' ),
|
'sp_team' => __( 'Teams', 'sportspress' ),
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function sportspress_team_meta_init( $post ) {
|
|||||||
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' );
|
||||||
remove_meta_box( 'postimagediv', 'sp_team', 'side' );
|
remove_meta_box( 'postimagediv', 'sp_team', 'side' );
|
||||||
add_meta_box( 'postimagediv', __( 'Logo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_team', 'side', 'high' );
|
add_meta_box( 'postimagediv', __( 'Logo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_team', 'side', 'low' );
|
||||||
|
|
||||||
if ( $leagues && $seasons ):
|
if ( $leagues && $seasons ):
|
||||||
add_meta_box( 'sp_columnssdiv', __( 'Table Columns', 'sportspress' ), 'sportspress_team_columns_meta', 'sp_team', 'normal', 'high' );
|
add_meta_box( 'sp_columnssdiv', __( 'Table Columns', 'sportspress' ), 'sportspress_team_columns_meta', 'sp_team', 'normal', 'high' );
|
||||||
@@ -36,7 +36,7 @@ function sportspress_team_meta_init( $post ) {
|
|||||||
function sportspress_team_edit_columns() {
|
function sportspress_team_edit_columns() {
|
||||||
$columns = array(
|
$columns = array(
|
||||||
'cb' => '<input type="checkbox" />',
|
'cb' => '<input type="checkbox" />',
|
||||||
'sp_logo' => ' ',
|
'sp_icon' => ' ',
|
||||||
'title' => __( 'Team', 'sportspress' ),
|
'title' => __( 'Team', 'sportspress' ),
|
||||||
'sp_league' => __( 'Leagues', 'sportspress' ),
|
'sp_league' => __( 'Leagues', 'sportspress' ),
|
||||||
'sp_season' => __( 'Seasons', 'sportspress' ),
|
'sp_season' => __( 'Seasons', 'sportspress' ),
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ function sportspress_position_term_init() {
|
|||||||
$name = __( 'Positions', 'sportspress' );
|
$name = __( 'Positions', 'sportspress' );
|
||||||
$singular_name = __( 'Position', 'sportspress' );
|
$singular_name = __( 'Position', 'sportspress' );
|
||||||
$lowercase_name = __( 'position', 'sportspress' );
|
$lowercase_name = __( 'position', 'sportspress' );
|
||||||
$object_type = array( 'sp_player' );
|
$object_type = array( 'sp_player', 'attachment' );
|
||||||
$labels = sportspress_get_term_labels( $name, $singular_name, $lowercase_name );
|
$labels = sportspress_get_term_labels( $name, $singular_name, $lowercase_name );
|
||||||
$args = array(
|
$args = array(
|
||||||
'label' => $name,
|
'label' => $name,
|
||||||
@@ -14,5 +14,6 @@ function sportspress_position_term_init() {
|
|||||||
);
|
);
|
||||||
register_taxonomy( 'sp_position', $object_type, $args );
|
register_taxonomy( 'sp_position', $object_type, $args );
|
||||||
register_taxonomy_for_object_type( 'sp_position', 'sp_player' );
|
register_taxonomy_for_object_type( 'sp_position', 'sp_player' );
|
||||||
|
register_taxonomy_for_object_type( 'sp_position', 'attachment' );
|
||||||
}
|
}
|
||||||
add_action( 'init', 'sportspress_position_term_init' );
|
add_action( 'init', 'sportspress_position_term_init' );
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ table.widefat.sp-data-table input.name {
|
|||||||
.sp-admin-config-table td {
|
.sp-admin-config-table td {
|
||||||
width: 20%;
|
width: 20%;
|
||||||
}
|
}
|
||||||
table.widefat th.column-sp_logo,
|
table.widefat th.column-sp_icon,
|
||||||
table.widefat td.column-sp_logo {
|
table.widefat td.column-sp_icon {
|
||||||
width: 32px;
|
width: 32px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
@@ -41,6 +41,25 @@ table.widefat td.column-sp_logo {
|
|||||||
height: 320px;
|
height: 320px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#adminmenu #menu-posts-sp_event .wp-menu-name:after,
|
||||||
|
#adminmenu #menu-posts-sp_team .wp-menu-name:after,
|
||||||
|
#adminmenu #menu-posts-sp_staff .wp-menu-name:after {
|
||||||
|
content: ' \03b2';
|
||||||
|
display: inline-block;
|
||||||
|
margin: 1px 0 0 6px;
|
||||||
|
vertical-align: top;
|
||||||
|
-webkit-border-radius: 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
z-index: 26;
|
||||||
|
background-color: #0074a2;
|
||||||
|
color: #fff;
|
||||||
|
width: 17px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 17px;
|
||||||
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 768px) {
|
@media only screen and (max-width: 768px) {
|
||||||
|
|
||||||
.form-field .sp-location-picker {
|
.form-field .sp-location-picker {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
}
|
}
|
||||||
.sp-data-table .data-name .logo {
|
.sp-data-table .data-name .logo {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
height: 2em;
|
height: 2.5em;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
116
functions.php
116
functions.php
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
if ( !function_exists( 'sportspress_event_details' ) ) {
|
if ( !function_exists( 'sportspress_event_details' ) ) {
|
||||||
function sportspress_event_details( $id ) {
|
function sportspress_event_details( $id = null ) {
|
||||||
|
|
||||||
|
if ( ! $id ):
|
||||||
|
global $post;
|
||||||
|
$id = $post->ID;
|
||||||
|
endif;
|
||||||
|
|
||||||
$date = get_the_time( get_option('date_format'), $id );
|
$date = get_the_time( get_option('date_format'), $id );
|
||||||
$time = get_the_time( get_option('time_format'), $id );
|
$time = get_the_time( get_option('time_format'), $id );
|
||||||
@@ -41,7 +46,12 @@ if ( !function_exists( 'sportspress_event_details' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !function_exists( 'sportspress_event_results' ) ) {
|
if ( !function_exists( 'sportspress_event_results' ) ) {
|
||||||
function sportspress_event_results( $id ) {
|
function sportspress_event_results( $id = null ) {
|
||||||
|
|
||||||
|
if ( ! $id ):
|
||||||
|
global $post;
|
||||||
|
$id = $post->ID;
|
||||||
|
endif;
|
||||||
|
|
||||||
$teams = (array)get_post_meta( $id, 'sp_team', false );
|
$teams = (array)get_post_meta( $id, 'sp_team', false );
|
||||||
$results = sportspress_array_combine( $teams, (array)get_post_meta( $id, 'sp_results', true ) );
|
$results = sportspress_array_combine( $teams, (array)get_post_meta( $id, 'sp_results', true ) );
|
||||||
@@ -102,7 +112,12 @@ if ( !function_exists( 'sportspress_event_results' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !function_exists( 'sportspress_event_players' ) ) {
|
if ( !function_exists( 'sportspress_event_players' ) ) {
|
||||||
function sportspress_event_players( $id ) {
|
function sportspress_event_players( $id = null ) {
|
||||||
|
|
||||||
|
if ( ! $id ):
|
||||||
|
global $post;
|
||||||
|
$id = $post->ID;
|
||||||
|
endif;
|
||||||
|
|
||||||
$teams = (array)get_post_meta( $id, 'sp_team', false );
|
$teams = (array)get_post_meta( $id, 'sp_team', false );
|
||||||
$staff = (array)get_post_meta( $id, 'sp_staff', false );
|
$staff = (array)get_post_meta( $id, 'sp_staff', false );
|
||||||
@@ -203,7 +218,12 @@ if ( !function_exists( 'sportspress_event_players' ) ) {
|
|||||||
|
|
||||||
|
|
||||||
if ( !function_exists( 'sportspress_event_staff' ) ) {
|
if ( !function_exists( 'sportspress_event_staff' ) ) {
|
||||||
function sportspress_event_staff( $id ) {
|
function sportspress_event_staff( $id = null ) {
|
||||||
|
|
||||||
|
if ( ! $id ):
|
||||||
|
global $post;
|
||||||
|
$id = $post->ID;
|
||||||
|
endif;
|
||||||
|
|
||||||
$staff = (array)get_post_meta( $id, 'sp_staff', false );
|
$staff = (array)get_post_meta( $id, 'sp_staff', false );
|
||||||
|
|
||||||
@@ -245,7 +265,20 @@ if ( !function_exists( 'sportspress_event_venue' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !function_exists( 'sportspress_league_table' ) ) {
|
if ( !function_exists( 'sportspress_league_table' ) ) {
|
||||||
function sportspress_league_table( $id ) {
|
function sportspress_league_table( $id = null, $args = '' ) {
|
||||||
|
|
||||||
|
if ( ! $id ):
|
||||||
|
global $post;
|
||||||
|
$id = $post->ID;
|
||||||
|
endif;
|
||||||
|
|
||||||
|
$defaults = array(
|
||||||
|
'number_label' => __( 'Pos', 'sportspress' ),
|
||||||
|
'thumbnails' => 1,
|
||||||
|
'thumbnail_size' => 'thumbnail'
|
||||||
|
);
|
||||||
|
|
||||||
|
$r = wp_parse_args( $args, $defaults );
|
||||||
|
|
||||||
$data = sportspress_get_league_table_data( $id );
|
$data = sportspress_get_league_table_data( $id );
|
||||||
|
|
||||||
@@ -257,7 +290,7 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
|
|||||||
// Remove the first row to leave us with the actual data
|
// Remove the first row to leave us with the actual data
|
||||||
unset( $data[0] );
|
unset( $data[0] );
|
||||||
|
|
||||||
$output .= '<th class="data-number">#</th>';
|
$output .= '<th class="data-number">' . $r['number_label'] . '</th>';
|
||||||
foreach( $labels as $key => $label ):
|
foreach( $labels as $key => $label ):
|
||||||
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
||||||
endforeach;
|
endforeach;
|
||||||
@@ -275,7 +308,11 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
|
|||||||
|
|
||||||
// Thumbnail and name as link
|
// Thumbnail and name as link
|
||||||
$permalink = get_post_permalink( $team_id );
|
$permalink = get_post_permalink( $team_id );
|
||||||
$thumbnail = get_the_post_thumbnail( $team_id, 'thumbnail', array( 'class' => 'logo' ) );
|
if ( $r['thumbnails'] ):
|
||||||
|
$thumbnail = get_the_post_thumbnail( $team_id, $r['thumbnail_size'], array( 'class' => 'logo' ) );
|
||||||
|
else:
|
||||||
|
$thumbnail = null;
|
||||||
|
endif;
|
||||||
$name = sportspress_array_value( $row, 'name', sportspress_array_value( $row, 'name', ' ' ) );
|
$name = sportspress_array_value( $row, 'name', sportspress_array_value( $row, 'name', ' ' ) );
|
||||||
$output .= '<td class="data-name">' . ( $thumbnail ? $thumbnail . ' ' : '' ) . '<a href="' . $permalink . '">' . $name . '</a></td>';
|
$output .= '<td class="data-name">' . ( $thumbnail ? $thumbnail . ' ' : '' ) . '<a href="' . $permalink . '">' . $name . '</a></td>';
|
||||||
|
|
||||||
@@ -300,7 +337,12 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
|
|||||||
|
|
||||||
|
|
||||||
if ( !function_exists( 'sportspress_team_columns' ) ) {
|
if ( !function_exists( 'sportspress_team_columns' ) ) {
|
||||||
function sportspress_team_columns( $id ) {
|
function sportspress_team_columns( $id = null ) {
|
||||||
|
|
||||||
|
if ( ! $id ):
|
||||||
|
global $post;
|
||||||
|
$id = $post->ID;
|
||||||
|
endif;
|
||||||
|
|
||||||
$leagues = get_the_terms( $id, 'sp_league' );
|
$leagues = get_the_terms( $id, 'sp_league' );
|
||||||
|
|
||||||
@@ -358,7 +400,12 @@ if ( !function_exists( 'sportspress_team_columns' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !function_exists( 'sportspress_player_list' ) ) {
|
if ( !function_exists( 'sportspress_player_list' ) ) {
|
||||||
function sportspress_player_list( $id ) {
|
function sportspress_player_list( $id = null ) {
|
||||||
|
|
||||||
|
if ( ! $id ):
|
||||||
|
global $post;
|
||||||
|
$id = $post->ID;
|
||||||
|
endif;
|
||||||
|
|
||||||
$data = sportspress_get_player_list_data( $id );
|
$data = sportspress_get_player_list_data( $id );
|
||||||
|
|
||||||
@@ -412,7 +459,12 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !function_exists( 'sportspress_player_metrics' ) ) {
|
if ( !function_exists( 'sportspress_player_metrics' ) ) {
|
||||||
function sportspress_player_metrics( $id ) {
|
function sportspress_player_metrics( $id = null ) {
|
||||||
|
|
||||||
|
if ( ! $id ):
|
||||||
|
global $post;
|
||||||
|
$id = $post->ID;
|
||||||
|
endif;
|
||||||
|
|
||||||
global $sportspress_countries;
|
global $sportspress_countries;
|
||||||
|
|
||||||
@@ -449,20 +501,15 @@ if ( !function_exists( 'sportspress_player_metrics' ) ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !function_exists( 'sportspress_player_statistics' ) ) {
|
if ( !function_exists( 'sportspress_player_league_statistics' ) ) {
|
||||||
function sportspress_player_statistics( $id ) {
|
function sportspress_player_league_statistics( $league_id, $id = null ) {
|
||||||
|
|
||||||
$leagues = get_the_terms( $id, 'sp_league' );
|
if ( ! $id ):
|
||||||
|
global $post;
|
||||||
|
$id = $post->ID;
|
||||||
|
endif;
|
||||||
|
|
||||||
$output = '';
|
$data = sportspress_get_player_statistics_data( $id, $league_id );
|
||||||
|
|
||||||
// Loop through statistics for each league
|
|
||||||
foreach ( $leagues as $league ):
|
|
||||||
|
|
||||||
if ( sizeof( $leagues ) > 1 )
|
|
||||||
$output .= '<h4 class="sp-player-league-name">' . $league->name . '</h4>';
|
|
||||||
|
|
||||||
$data = sportspress_get_player_statistics_data( $id, $league->term_id );
|
|
||||||
|
|
||||||
// The first row should be column labels
|
// The first row should be column labels
|
||||||
$labels = $data[0];
|
$labels = $data[0];
|
||||||
@@ -470,7 +517,7 @@ if ( !function_exists( 'sportspress_player_statistics' ) ) {
|
|||||||
// Remove the first row to leave us with the actual data
|
// Remove the first row to leave us with the actual data
|
||||||
unset( $data[0] );
|
unset( $data[0] );
|
||||||
|
|
||||||
$output .= '<table class="sp-player-statistics sp-data-table">' . '<thead>' . '<tr>';
|
$output = '<table class="sp-player-statistics sp-data-table">' . '<thead>' . '<tr>';
|
||||||
|
|
||||||
foreach( $labels as $key => $label ):
|
foreach( $labels as $key => $label ):
|
||||||
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
||||||
@@ -496,6 +543,29 @@ if ( !function_exists( 'sportspress_player_statistics' ) ) {
|
|||||||
|
|
||||||
$output .= '</tbody>' . '</table>';
|
$output .= '</tbody>' . '</table>';
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !function_exists( 'sportspress_player_statistics' ) ) {
|
||||||
|
function sportspress_player_statistics( $id = null ) {
|
||||||
|
|
||||||
|
if ( ! $id ):
|
||||||
|
global $post;
|
||||||
|
$id = $post->ID;
|
||||||
|
endif;
|
||||||
|
|
||||||
|
$leagues = get_the_terms( $id, 'sp_league' );
|
||||||
|
|
||||||
|
$output = '';
|
||||||
|
|
||||||
|
// Loop through statistics for each league
|
||||||
|
foreach ( $leagues as $league ):
|
||||||
|
|
||||||
|
if ( sizeof( $leagues ) > 1 )
|
||||||
|
$output .= '<h4 class="sp-table-name sp-player-league-name">' . $league->name . '</h4>';
|
||||||
|
|
||||||
|
$output .= sportspress_player_league_statistics( $league->term_id, $id );
|
||||||
|
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user