Add format option to player performance
This commit is contained in:
@@ -43,6 +43,8 @@ class SP_Admin_CPT_Performance extends SP_Admin_CPT {
|
|||||||
'sp_icon' => __( 'Icon', 'sportspress' ),
|
'sp_icon' => __( 'Icon', 'sportspress' ),
|
||||||
'title' => __( 'Label', 'sportspress' ),
|
'title' => __( 'Label', 'sportspress' ),
|
||||||
'sp_key' => __( 'Variable', 'sportspress' ),
|
'sp_key' => __( 'Variable', 'sportspress' ),
|
||||||
|
'sp_section' => __( 'Category', 'sportspress' ),
|
||||||
|
'sp_config_format' => __( 'Format', 'sportspress' ),
|
||||||
'sp_description' => __( 'Description', 'sportspress' ),
|
'sp_description' => __( 'Description', 'sportspress' ),
|
||||||
);
|
);
|
||||||
return apply_filters( 'sportspress_performance_admin_columns', $columns );
|
return apply_filters( 'sportspress_performance_admin_columns', $columns );
|
||||||
@@ -61,6 +63,14 @@ class SP_Admin_CPT_Performance extends SP_Admin_CPT {
|
|||||||
global $post;
|
global $post;
|
||||||
echo $post->post_name;
|
echo $post->post_name;
|
||||||
break;
|
break;
|
||||||
|
case 'sp_section':
|
||||||
|
global $post;
|
||||||
|
echo sp_get_post_section( $post->ID );
|
||||||
|
break;
|
||||||
|
case 'sp_config_format':
|
||||||
|
global $post;
|
||||||
|
echo sp_get_post_format( $post->ID );
|
||||||
|
break;
|
||||||
case 'sp_description':
|
case 'sp_description':
|
||||||
global $post;
|
global $post;
|
||||||
echo '<span class="description">' . $post->post_excerpt . '</span>';
|
echo '<span class="description">' . $post->post_excerpt . '</span>';
|
||||||
|
|||||||
@@ -20,19 +20,7 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
*/
|
*/
|
||||||
public static function output( $post ) {
|
public static function output( $post ) {
|
||||||
$event = new SP_Event( $post );
|
$event = new SP_Event( $post );
|
||||||
list( $labels, $columns, $stats, $teams ) = $event->performance( true );
|
list( $labels, $columns, $stats, $teams, $formats ) = $event->performance( true );
|
||||||
|
|
||||||
// Determine if we are splitting positions
|
|
||||||
if ( 'yes' == get_option( 'sportspress_event_split_players_by_position', 'no' ) )
|
|
||||||
$split_positions = true;
|
|
||||||
else
|
|
||||||
$split_positions = false;
|
|
||||||
|
|
||||||
// Determine if we are splitting teams
|
|
||||||
if ( 'yes' == get_option( 'sportspress_event_split_players_by_team', 'yes' ) )
|
|
||||||
$split_teams = true;
|
|
||||||
else
|
|
||||||
$split_teams = false;
|
|
||||||
|
|
||||||
// Determine if columns are auto or manual
|
// Determine if columns are auto or manual
|
||||||
if ( 'manual' == get_option( 'sportspress_event_performance_columns', 'auto' ) )
|
if ( 'manual' == get_option( 'sportspress_event_performance_columns', 'auto' ) )
|
||||||
@@ -48,7 +36,7 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
|
|
||||||
// Get positions
|
// Get positions
|
||||||
$positions = array();
|
$positions = array();
|
||||||
if ( taxonomy_exists( 'sp_position' ) ):
|
if ( 'yes' == get_option( 'sportspress_event_show_position', 'yes' ) && taxonomy_exists( 'sp_position' ) ):
|
||||||
$args = array(
|
$args = array(
|
||||||
'hide_empty' => false,
|
'hide_empty' => false,
|
||||||
'parent' => 0,
|
'parent' => 0,
|
||||||
@@ -66,7 +54,7 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
// Apply filters to labels
|
// Apply filters to labels
|
||||||
$labels = apply_filters( 'sportspress_event_performance_labels_admin', $labels );
|
$labels = apply_filters( 'sportspress_event_performance_labels_admin', $labels );
|
||||||
|
|
||||||
self::tables( $post->ID, $stats, $labels, $columns, $teams, $has_checkboxes, $split_positions, $split_teams, $positions, $status );
|
self::tables( $post->ID, $stats, $labels, $columns, $teams, $has_checkboxes, $positions, $status, $formats );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,95 +68,96 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
/**
|
/**
|
||||||
* Admin edit tables
|
* Admin edit tables
|
||||||
*/
|
*/
|
||||||
public static function tables( $post_id, $stats = array(), $labels = array(), $columns = array(), $teams = array(), $has_checkboxes = false, $split_positions = false, $split_teams = true, $positions = array(), $status = true ) {
|
public static function tables( $post_id, $stats = array(), $labels = array(), $columns = array(), $teams = array(), $has_checkboxes = false, $positions = array(), $status = true, $formats = array() ) {
|
||||||
|
$sections = get_option( 'sportspress_event_performance_sections', -1 );
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
if ( $split_teams ) {
|
foreach ( $teams as $key => $team_id ):
|
||||||
foreach ( $teams as $key => $team_id ):
|
if ( -1 == $team_id ) continue;
|
||||||
if ( -1 == $team_id ) continue;
|
|
||||||
|
|
||||||
|
if ( -1 == $sections ) {
|
||||||
// Get results for players in the team
|
// Get results for players in the team
|
||||||
$players = sp_array_between( (array)get_post_meta( $post_id, 'sp_player', false ), 0, $key );
|
$players = sp_array_between( (array)get_post_meta( $post_id, 'sp_player', false ), 0, $key );
|
||||||
$players[] = -1;
|
$players[] = -1;
|
||||||
$data = sp_array_combine( $players, sp_array_value( $stats, $team_id, array() ) );
|
$data = sp_array_combine( $players, sp_array_value( $stats, $team_id, array() ) );
|
||||||
|
|
||||||
$tabs = array();
|
|
||||||
|
|
||||||
if ( $team_id ):
|
|
||||||
$tabs['values'] = get_the_title( $team_id );
|
|
||||||
elseif ( $i ):
|
|
||||||
echo '<br>';
|
|
||||||
endif;
|
|
||||||
|
|
||||||
$tabs = apply_filters( 'sportspress_event_performance_tabs_admin', $tabs );
|
|
||||||
?>
|
?>
|
||||||
<div>
|
<div>
|
||||||
<?php if ( sizeof( $tabs ) ): ?>
|
<p><strong><?php echo get_the_title( $team_id ); ?></strong></p>
|
||||||
<?php if ( sizeof( $tabs ) > 1 ): ?>
|
<?php self::table( $labels, $columns, $data, $team_id, $has_checkboxes, $positions, $status, -1, $formats ); ?>
|
||||||
<ul class="subsubsub sp-performance-table-bar">
|
|
||||||
<?php $t = 0; ?>
|
|
||||||
<?php foreach ( $tabs as $key => $label ): ?>
|
|
||||||
<li>
|
|
||||||
<a href="#"<?php if ( 0 == $t ): ?> class="current"<?php endif; ?>>
|
|
||||||
<?php echo $label; ?>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php if ( sizeof( $tabs ) > $t + 1 ): ?> | <?php endif; ?>
|
|
||||||
<?php $t++; ?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</ul>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php $label = reset( $tabs ); ?>
|
|
||||||
<p><strong><?php echo $label; ?></strong></p>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php self::table( $labels, $columns, $data, $team_id, $has_checkboxes, $split_positions, $positions, $status ); ?>
|
|
||||||
<?php do_action( 'sportspress_after_event_performance_table_admin', $labels, $columns, $data, $team_id ); ?>
|
<?php do_action( 'sportspress_after_event_performance_table_admin', $labels, $columns, $data, $team_id ); ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php } else { ?>
|
||||||
<?php
|
<?php
|
||||||
$i ++;
|
// Get labels by section
|
||||||
endforeach;
|
$args = array(
|
||||||
} else {
|
'post_type' => 'sp_performance',
|
||||||
?>
|
'numberposts' => 100,
|
||||||
<div class="sp-data-table-container">
|
'posts_per_page' => 100,
|
||||||
<table class="widefat sp-data-table sp-performance-table sp-sortable-table">
|
'orderby' => 'menu_order',
|
||||||
<?php self::header( $columns, $labels, $positions, $has_checkboxes, $status, false, false ); ?>
|
'order' => 'ASC',
|
||||||
<?php self::footer( sp_array_value( $stats, -1 ), $labels, 0, $positions, $split_positions, $status, false, false ); ?>
|
);
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
foreach ( $teams as $key => $team_id ):
|
|
||||||
if ( -1 == $team_id ) continue;
|
|
||||||
|
|
||||||
// Get results for players in the team
|
$columns = get_posts( $args );
|
||||||
$players = sp_array_between( (array)get_post_meta( $post_id, 'sp_player', false ), 0, $key );
|
|
||||||
$players[] = -1;
|
|
||||||
$data = sp_array_combine( $players, sp_array_value( $stats, $team_id, array() ) );
|
|
||||||
|
|
||||||
foreach ( $data as $player_id => $player_performance ):
|
$offense_labels = $defense_labels = array();
|
||||||
self::row( $labels, $player_id, $player_performance, $team_id, $data, ! empty( $positions ), $status, false, false );
|
foreach ( $columns as $column ):
|
||||||
endforeach;
|
$section = get_post_meta( $column->ID, 'sp_section', true );
|
||||||
endforeach;
|
if ( '' === $section ) {
|
||||||
?>
|
$section = -1;
|
||||||
</tbody>
|
}
|
||||||
</table>
|
switch ( $section ):
|
||||||
</div>
|
case 1:
|
||||||
|
$defense_labels[ $column->post_name ] = $column->post_title;
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
$offense_labels[ $column->post_name ] = $column->post_title;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$defense_labels[ $column->post_name ] = $column->post_title;
|
||||||
|
$offense_labels[ $column->post_name ] = $column->post_title;
|
||||||
|
endswitch;
|
||||||
|
endforeach;
|
||||||
|
|
||||||
|
// Get results for offensive players in the team
|
||||||
|
$offense = sp_array_between( (array)get_post_meta( $post_id, 'sp_offense', false ), 0, $key );
|
||||||
|
$offense[] = -1;
|
||||||
|
$offense_data = sp_array_combine( $offense, sp_array_value( $stats, $team_id, array() ) );
|
||||||
|
|
||||||
|
// Get results for defensive players in the team
|
||||||
|
$defense = sp_array_between( (array)get_post_meta( $post_id, 'sp_defense', false ), 0, $key );
|
||||||
|
$defense[] = -1;
|
||||||
|
$defense_data = sp_array_combine( $defense, sp_array_value( $stats, $team_id, array() ) );
|
||||||
|
?>
|
||||||
|
<div>
|
||||||
|
<p><strong><?php echo get_the_title( $team_id ); ?> — <?php _e( 'Offense', 'sportspress' ); ?></strong></p>
|
||||||
|
<?php self::table( $offense_labels, $columns, $offense_data, $team_id, $has_checkboxes, $positions, $status, 0, $formats ); ?>
|
||||||
|
<?php do_action( 'sportspress_after_event_performance_table_admin', $offense_labels, $columns, $offense_data, $team_id ); ?>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p><strong><?php echo get_the_title( $team_id ); ?> — <?php _e( 'Defense', 'sportspress' ); ?></strong></p>
|
||||||
|
<?php self::table( $defense_labels, $columns, $defense_data, $team_id, $has_checkboxes, $positions, $status, 1, $formats ); ?>
|
||||||
|
<?php do_action( 'sportspress_after_event_performance_table_admin', $defense_labels, $columns, $defense_data, $team_id ); ?>
|
||||||
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
$i ++;
|
||||||
|
endforeach;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Admin edit table
|
* Admin edit table
|
||||||
*/
|
*/
|
||||||
public static function table( $labels = array(), $columns = array(), $data = array(), $team_id, $has_checkboxes = false, $split_positions = false, $positions = array(), $status = true ) {
|
public static function table( $labels = array(), $columns = array(), $data = array(), $team_id, $has_checkboxes = false, $positions = array(), $status = true, $section = -1, $formats = array() ) {
|
||||||
?>
|
?>
|
||||||
<div class="sp-data-table-container">
|
<div class="sp-data-table-container">
|
||||||
<table class="widefat sp-data-table sp-performance-table sp-sortable-table">
|
<table class="widefat sp-data-table sp-performance-table sp-sortable-table">
|
||||||
<?php self::header( $columns, $labels, $positions, $has_checkboxes, $status ); ?>
|
<?php self::header( $columns, $labels, $positions, $has_checkboxes, $status, true, true, $section, $formats ); ?>
|
||||||
<?php self::footer( $data, $labels, $team_id, $positions, $split_positions, $status ); ?>
|
<?php self::footer( $data, $labels, $team_id, $positions, $status, true, true, $section, $formats ); ?>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
foreach ( $data as $player_id => $player_performance ):
|
foreach ( $data as $player_id => $player_performance ):
|
||||||
self::row( $labels, $player_id, $player_performance, $team_id, $data, ! empty( $positions ), $status );
|
self::row( $labels, $player_id, $player_performance, $team_id, $data, ! empty( $positions ), $status, true, true, $section, $formats );
|
||||||
endforeach;
|
endforeach;
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -180,7 +169,7 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
/**
|
/**
|
||||||
* Admin edit table header
|
* Admin edit table header
|
||||||
*/
|
*/
|
||||||
public static function header( $columns = array(), $labels = array(), $positions = array(), $has_checkboxes = false, $status = true, $sortable = true, $numbers = true ) {
|
public static function header( $columns = array(), $labels = array(), $positions = array(), $has_checkboxes = false, $status = true, $sortable = true, $numbers = true, $section = -1, $formats = array() ) {
|
||||||
?>
|
?>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -221,10 +210,10 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
/**
|
/**
|
||||||
* Admin edit table footer
|
* Admin edit table footer
|
||||||
*/
|
*/
|
||||||
public static function footer( $data = array(), $labels = array(), $team_id = 0, $positions = array(), $split_positions = false, $status = true, $sortable = true, $numbers = true ) {
|
public static function footer( $data = array(), $labels = array(), $team_id = 0, $positions = array(), $status = true, $sortable = true, $numbers = true, $section = -1, $formats = array() ) {
|
||||||
?>
|
?>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<?php do_action( 'sportspress_event_performance_meta_box_table_footer', $data, $labels, $team_id, $positions, $status, $sortable, $numbers ); ?>
|
<?php do_action( 'sportspress_event_performance_meta_box_table_footer', $data, $labels, $team_id, $positions, $status, $sortable, $numbers, $section ); ?>
|
||||||
<?php if ( $team_id ) { ?>
|
<?php if ( $team_id ) { ?>
|
||||||
<tr class="sp-row sp-total">
|
<tr class="sp-row sp-total">
|
||||||
<?php if ( $sortable ) { ?>
|
<?php if ( $sortable ) { ?>
|
||||||
@@ -242,7 +231,7 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
$player_performance = sp_array_value( $data, $player_id, array() );
|
$player_performance = sp_array_value( $data, $player_id, array() );
|
||||||
$value = sp_array_value( $player_performance, $column, '' );
|
$value = sp_array_value( $player_performance, $column, '' );
|
||||||
?>
|
?>
|
||||||
<td><input type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" placeholder="0" <?php if ( $split_positions ) { ?>readonly="readonly"<?php } else { ?>value="<?php echo esc_attr( $value ); ?>"<?php } ?> /></td>
|
<td><input type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" placeholder="0" value="<?php echo esc_attr( $value ); ?>" /></td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if ( $status ) { ?>
|
<?php if ( $status ) { ?>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
@@ -256,7 +245,7 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
/**
|
/**
|
||||||
* Admin edit table row
|
* Admin edit table row
|
||||||
*/
|
*/
|
||||||
public static function row( $labels = array(), $player_id = 0, $player_performance = array(), $team_id = 0, $data = array(), $positions = true, $status = true, $sortable = true, $numbers = true ) {
|
public static function row( $labels = array(), $player_id = 0, $player_performance = array(), $team_id = 0, $data = array(), $positions = true, $status = true, $sortable = true, $numbers = true, $section = -1, $formats = array() ) {
|
||||||
if ( $player_id <= 0 ) return;
|
if ( $player_id <= 0 ) return;
|
||||||
|
|
||||||
$number = get_post_meta( $player_id, 'sp_number', true );
|
$number = get_post_meta( $player_id, 'sp_number', true );
|
||||||
@@ -296,9 +285,10 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php foreach( $labels as $column => $label ):
|
<?php foreach( $labels as $column => $label ):
|
||||||
$value = sp_array_value( $player_performance, $column, '' );
|
$value = sp_array_value( $player_performance, $column, '' );
|
||||||
|
$placeholder = sp_get_format_placeholder( sp_array_value( $formats, $column, 'number' ) );
|
||||||
?>
|
?>
|
||||||
<td>
|
<td>
|
||||||
<input class="sp-player-<?php echo $column; ?>-input" type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo esc_attr( $value ); ?>" placeholder="0" />
|
<input class="sp-player-<?php echo $column; ?>-input" type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo esc_attr( $value ); ?>" placeholder="<?php echo $placeholder; ?>" />
|
||||||
</td>
|
</td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if ( $status ) { ?>
|
<?php if ( $status ) { ?>
|
||||||
|
|||||||
@@ -162,7 +162,8 @@
|
|||||||
<th class="icon" scope="col"><?php _e( 'Icon', 'sportspress' ); ?></th>
|
<th class="icon" scope="col"><?php _e( 'Icon', 'sportspress' ); ?></th>
|
||||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||||
<th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
|
||||||
<th scope="col"><?php _e( 'Position', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Category', 'sportspress' ); ?></th>
|
||||||
|
<th scope="col"><?php _e( 'Format', 'sportspress' ); ?></th>
|
||||||
<th scope="col"><?php _e( 'Description', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Description', 'sportspress' ); ?></th>
|
||||||
<th scope="col" class="edit"></th>
|
<th scope="col" class="edit"></th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -171,7 +172,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th class="radio"><input type="radio" class="sp-primary-performance-option" id="sportspress_primary_performance_0" name="sportspress_primary_performance" value="0" <?php checked( $selection, 0 ); ?>></th>
|
<th class="radio"><input type="radio" class="sp-primary-performance-option" id="sportspress_primary_performance_0" name="sportspress_primary_performance" value="0" <?php checked( $selection, 0 ); ?>></th>
|
||||||
<th class="icon"> </td>
|
<th class="icon"> </td>
|
||||||
<th colspan="5"><label for="sportspress_primary_performance_0">
|
<th colspan="6"><label for="sportspress_primary_performance_0">
|
||||||
<?php
|
<?php
|
||||||
if ( sizeof( $data ) > 0 ):
|
if ( sizeof( $data ) > 0 ):
|
||||||
$default = reset( $data );
|
$default = reset( $data );
|
||||||
@@ -198,13 +199,14 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||||
<td><code><?php echo $row->post_name; ?></code></td>
|
<td><code><?php echo $row->post_name; ?></code></td>
|
||||||
<td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : __( 'All', 'sportspress' );; ?></td>
|
<td><?php echo sp_get_post_section( $row->ID ); ?></td>
|
||||||
|
<td><?php echo sp_get_post_format( $row->ID ); ?></td>
|
||||||
<td><p class="description"><?php echo $row->post_excerpt; ?></p></td>
|
<td><p class="description"><?php echo $row->post_excerpt; ?></p></td>
|
||||||
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
|
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php $i++; endforeach; else: ?>
|
<?php $i++; endforeach; else: ?>
|
||||||
<tr class="alternate">
|
<tr class="alternate">
|
||||||
<td colspan="7"><?php _e( 'No results found.', 'sportspress' ); ?></td>
|
<td colspan="8"><?php _e( 'No results found.', 'sportspress' ); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -75,7 +75,28 @@ class SP_Event extends SP_Custom_Post{
|
|||||||
public function performance( $admin = false ) {
|
public function performance( $admin = false ) {
|
||||||
$teams = get_post_meta( $this->ID, 'sp_team', false );
|
$teams = get_post_meta( $this->ID, 'sp_team', false );
|
||||||
$performance = (array)get_post_meta( $this->ID, 'sp_players', true );
|
$performance = (array)get_post_meta( $this->ID, 'sp_players', true );
|
||||||
$labels = apply_filters( 'sportspress_event_performance_labels', sp_get_var_labels( 'sp_performance' ), $this );
|
|
||||||
|
$args = array(
|
||||||
|
'post_type' => 'sp_performance',
|
||||||
|
'numberposts' => 100,
|
||||||
|
'posts_per_page' => 100,
|
||||||
|
'orderby' => 'menu_order',
|
||||||
|
'order' => 'ASC',
|
||||||
|
);
|
||||||
|
|
||||||
|
$vars = get_posts( $args );
|
||||||
|
|
||||||
|
$labels = array();
|
||||||
|
foreach ( $vars as $var ) {
|
||||||
|
$labels[ $var->post_name ] = $var->post_title;
|
||||||
|
$format = get_post_meta( $var->ID, 'sp_format', true );
|
||||||
|
if ( '' === $format ) {
|
||||||
|
$format = 'number';
|
||||||
|
}
|
||||||
|
$formats[ $var->post_name ] = $format;
|
||||||
|
}
|
||||||
|
|
||||||
|
$labels = apply_filters( 'sportspress_event_performance_labels', $labels, $this );
|
||||||
$columns = get_post_meta( $this->ID, 'sp_columns', true );
|
$columns = get_post_meta( $this->ID, 'sp_columns', true );
|
||||||
if ( is_array( $teams ) ):
|
if ( is_array( $teams ) ):
|
||||||
foreach( $teams as $i => $team_id ):
|
foreach( $teams as $i => $team_id ):
|
||||||
@@ -111,7 +132,7 @@ class SP_Event extends SP_Custom_Post{
|
|||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ( $admin ):
|
if ( $admin ):
|
||||||
return array( $labels, $columns, $performance, $teams );
|
return array( $labels, $columns, $performance, $teams, $formats );
|
||||||
else:
|
else:
|
||||||
// Add position to performance labels
|
// Add position to performance labels
|
||||||
if ( taxonomy_exists( 'sp_position' ) ):
|
if ( taxonomy_exists( 'sp_position' ) ):
|
||||||
|
|||||||
Reference in New Issue
Block a user