Rename event players to event statistics

This commit is contained in:
Brian Miyaji
2014-03-22 17:08:45 +11:00
parent ce292db5cd
commit b9b7d54c0d
3 changed files with 18 additions and 11 deletions

View File

@@ -11,7 +11,7 @@ function sportspress_default_event_content( $content ) {
if ( is_singular( 'sp_event' ) && in_the_loop() ):
$details = sportspress_event_details();
$results = sportspress_event_results();
$players = sportspress_event_players();
$statistics = sportspress_event_statistics();
$staff = sportspress_event_staff();
$id = get_the_ID();
$video_url = get_post_meta( $id, 'sp_video', true );
@@ -22,10 +22,10 @@ function sportspress_default_event_content( $content ) {
$video = '';
endif;
if ( $results ):
$content = $video . $results . $details . $players . $staff . $content;
$content = $video . $results . $details . $statistics . $staff . $content;
else:
$venue = sportspress_event_venue();
$content = $video . $details . $venue . $players . $staff . $content;
$content = $video . $details . $venue . $statistics . $staff . $content;
endif;
endif;
return $content;

View File

@@ -1,6 +1,7 @@
<?php
if ( !function_exists( 'sportspress_event_players' ) ) {
function sportspress_event_players( $id = null ) {
if ( !function_exists( 'sportspress_event_statistics' ) ) {
function sportspress_event_statistics( $id = null ) {
global $sportspress_options;
if ( ! $id )
$id = get_the_ID();
@@ -9,6 +10,9 @@ if ( !function_exists( 'sportspress_event_players' ) ) {
$staff = (array)get_post_meta( $id, 'sp_staff', false );
$stats = (array)get_post_meta( $id, 'sp_players', true );
$statistic_labels = sportspress_get_var_labels( 'sp_statistic' );
$link_posts = sportspress_array_value( $sportspress_options, 'event_statistics_link_posts', true );
$sortable = sportspress_array_value( $sportspress_options, 'event_statistics_sortable', true );
$responsive = sportspress_array_value( $sportspress_options, 'event_statistics_responsive', true );
$output = '';
@@ -24,7 +28,7 @@ if ( !function_exists( 'sportspress_event_players' ) ) {
$output .= '<h3>' . get_the_title( $team_id ) . '</h3>';
$output .= '<div class="sp-table-wrapper">' .
'<table class="sp-event-statistics sp-data-table sp-responsive-table">' . '<thead>' . '<tr>';
'<table class="sp-event-statistics sp-data-table' . ( $responsive ? ' sp-responsive-table' : '' ) . ( $sortable ? ' sp-sortable-table' : '' ) . '">' . '<thead>' . '<tr>';
$output .= '<th class="data-number">#</th>';
$output .= '<th class="data-number">' . __( 'Player', 'sportspress' ) . '</th>';
@@ -54,9 +58,12 @@ if ( !function_exists( 'sportspress_event_players' ) ) {
// Player number
$output .= '<td class="data-number">' . $number . '</td>';
// Name as link
$permalink = get_post_permalink( $player_id );
$output .= '<td class="data-name">' . '<a href="' . $permalink . '">' . $name . '</a></td>';
if ( $link_posts ):
$permalink = get_post_permalink( $player_id );
$name = '<a href="' . $permalink . '">' . $name . '</a>';
endif;
$output .= '<td class="data-name">' . $name . '</td>';
foreach( $statistic_labels as $key => $label ):
if ( $key == 'name' )
@@ -113,7 +120,7 @@ if ( !function_exists( 'sportspress_event_players' ) ) {
endforeach;
return apply_filters( 'sportspress_event_players', $output );
return apply_filters( 'sportspress_event_statistics', $output );
}
}

View File

@@ -35,7 +35,7 @@ require_once dirname( __FILE__ ) . '/functions.php';
// Templates
require_once dirname( __FILE__ ) . '/admin/templates/countdown.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-details.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-players.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-statistics.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-results.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-staff.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-venue.php';