Enable individual player performance and statistics
This commit is contained in:
@@ -481,7 +481,7 @@ if ( class_exists( 'WP_Importer' ) ) {
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'values' => 'slug',
|
||||
'show_option_none' => __( '-- Not set --', 'sportspress' ),
|
||||
'show_option_none' => __( '— Not set —', 'sportspress' ),
|
||||
);
|
||||
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||
echo '<p>' . __( 'None', 'sportspress' ) . '</p>';
|
||||
@@ -496,7 +496,7 @@ if ( class_exists( 'WP_Importer' ) ) {
|
||||
'taxonomy' => 'sp_season',
|
||||
'name' => 'sp_season',
|
||||
'values' => 'slug',
|
||||
'show_option_none' => __( '-- Not set --', 'sportspress' ),
|
||||
'show_option_none' => __( '— Not set —', 'sportspress' ),
|
||||
);
|
||||
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||
echo '<p>' . __( 'None', 'sportspress' ) . '</p>';
|
||||
|
||||
@@ -43,7 +43,8 @@ class SP_Meta_Box_Event_Details {
|
||||
'class' => 'sp-has-dummy',
|
||||
'selected' => sp_get_the_term_id_or_meta( $post->ID, $taxonomy ),
|
||||
'values' => 'term_id',
|
||||
'show_option_none' => __( '-- Not set --', 'sportspress' ),
|
||||
'show_option_none' => __( '— Not set —', 'sportspress' ),
|
||||
'chosen' => true,
|
||||
);
|
||||
if ( in_array( $taxonomy, apply_filters( 'sportspress_event_auto_taxonomies', array( 'sp_venue' ) ) ) ) {
|
||||
$args['show_option_all'] = __( '(Auto)', 'sportspress' );
|
||||
|
||||
@@ -19,22 +19,23 @@ class SP_Meta_Box_Event_Shortcode {
|
||||
* Output the metabox
|
||||
*/
|
||||
public static function output( $post ) {
|
||||
$shortcodes = apply_filters( 'sportspress_event_shortcodes', array(
|
||||
'event_results' => __( 'Event Results', 'sportspress' ),
|
||||
'event_details' => __( 'Details', 'sportspress' ),
|
||||
'event_performance' => __( 'Player Performance', 'sportspress' ),
|
||||
) );
|
||||
if ( $shortcodes ) {
|
||||
?>
|
||||
<p class="howto">
|
||||
<?php _e( 'Copy this code and paste it into your post, page or text widget content.', 'sportspress' ); ?>
|
||||
</p>
|
||||
<?php foreach ( $shortcodes as $id => $label ) { ?>
|
||||
<p>
|
||||
<strong><?php _e( 'Event Results', 'sportspress' ); ?></strong>
|
||||
<strong><?php echo $label; ?></strong>
|
||||
</p>
|
||||
<p><input type="text" value="[event_results <?php echo $post->ID; ?>]" readonly="readonly" class="code widefat"></p>
|
||||
<p>
|
||||
<strong><?php _e( 'Details', 'sportspress' ); ?></strong>
|
||||
</p>
|
||||
<p><input type="text" value="[event_details <?php echo $post->ID; ?>]" readonly="readonly" class="code widefat"></p>
|
||||
<p>
|
||||
<strong><?php _e( 'Player Performance', 'sportspress' ); ?></strong>
|
||||
</p>
|
||||
<p><input type="text" value="[event_performance <?php echo $post->ID; ?>]" readonly="readonly" class="code widefat"></p>
|
||||
<p><input type="text" value="[<?php echo $id; ?> <?php echo $post->ID; ?>]" readonly="readonly" class="code widefat"></p>
|
||||
<?php } ?>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,17 +19,22 @@ class SP_Meta_Box_Player_Columns {
|
||||
* Output the metabox
|
||||
*/
|
||||
public static function output( $post ) {
|
||||
$selected = (array) get_post_meta( $post->ID, 'sp_columns', true );
|
||||
$tabs = apply_filters( 'sportspress_player_column_tabs', array( 'sp_performance', 'sp_statistic' ) );
|
||||
?>
|
||||
<div class="sp-instance">
|
||||
<?php if ( $tabs ) { ?>
|
||||
<ul id="sp_column-tabs" class="wp-tab-bar sp-tab-bar">
|
||||
<li class="wp-tab-active"><a href="#sp_performance-all"><?php _e( 'Performance', 'sportspress' ); ?></a></li>
|
||||
<li class="wp-tab"><a href="#sp_statistic-all"><?php _e( 'Statistics', 'sportspress' ); ?></a></li>
|
||||
<?php foreach ( $tabs as $index => $post_type ) { $object = get_post_type_object( $post_type ); ?>
|
||||
<li class="wp-tab<?php if ( 0 == $index ) { ?>-active<?php } ?>"><a href="#<?php echo $post_type; ?>-all"><?php echo $object->labels->name; ?></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?php
|
||||
$selected = (array)get_post_meta( $post->ID, 'sp_columns', true );
|
||||
sp_column_checklist( $post->ID, 'sp_performance', 'block', $selected );
|
||||
sp_column_checklist( $post->ID, 'sp_statistic', 'none', $selected );
|
||||
foreach ( $tabs as $index => $post_type ) {
|
||||
sp_column_checklist( $post->ID, $post_type, ( 0 == $index ? 'block' : 'none' ), $selected );
|
||||
}
|
||||
?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @author ThemeBoy
|
||||
* @category Admin
|
||||
* @package SportsPress/Admin/Meta_Boxes
|
||||
* @version 1.5
|
||||
* @version 1.6
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
@@ -61,7 +61,7 @@ class SP_Meta_Box_Player_Statistics {
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php _e( 'Season', 'sportspress' ); ?></th>
|
||||
<?php if ( $league_id ): ?>
|
||||
<?php if ( apply_filters( 'sportspress_player_team_statistics', $league_id ) ): ?>
|
||||
<th>
|
||||
<?php if ( $has_checkboxes ): ?>
|
||||
<label for="sp_columns_team">
|
||||
@@ -89,8 +89,11 @@ class SP_Meta_Box_Player_Statistics {
|
||||
<td>
|
||||
<?php if ( 0 !== $div_id ): ?>
|
||||
<label>
|
||||
<?php $value = sp_array_value( $leagues, $div_id, '-1' ); ?>
|
||||
<input type="checkbox" name="sp_leagues[<?php echo $league_id; ?>][<?php echo $div_id; ?>]" value="1" <?php checked( $value ); ?>>
|
||||
<?php if ( ! apply_filters( 'sportspress_player_team_statistics', $league_id ) ): ?>
|
||||
<?php $value = sp_array_value( $leagues, $div_id, '-1' ); ?>
|
||||
<input type="hidden" name="sp_leagues[<?php echo $league_id; ?>][<?php echo $div_id; ?>]" value="-1">
|
||||
<input type="checkbox" name="sp_leagues[<?php echo $league_id; ?>][<?php echo $div_id; ?>]" value="1" <?php checked( $value ); ?>>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
if ( 'WP_Error' == get_class( $div ) ) _e( 'Total', 'sportspress' );
|
||||
else echo $div->name;
|
||||
@@ -103,7 +106,7 @@ class SP_Meta_Box_Player_Statistics {
|
||||
?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php if ( $league_id ): ?>
|
||||
<?php if ( apply_filters( 'sportspress_player_team_statistics', $league_id ) ): ?>
|
||||
<?php if ( $div_id == 0 ): ?>
|
||||
<td> </td>
|
||||
<?php else: ?>
|
||||
|
||||
Reference in New Issue
Block a user