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

View File

@@ -1,6 +1,7 @@
<?php <?php
if ( !function_exists( 'sportspress_event_players' ) ) { if ( !function_exists( 'sportspress_event_statistics' ) ) {
function sportspress_event_players( $id = null ) { function sportspress_event_statistics( $id = null ) {
global $sportspress_options;
if ( ! $id ) if ( ! $id )
$id = get_the_ID(); $id = get_the_ID();
@@ -9,6 +10,9 @@ if ( !function_exists( 'sportspress_event_players' ) ) {
$staff = (array)get_post_meta( $id, 'sp_staff', false ); $staff = (array)get_post_meta( $id, 'sp_staff', false );
$stats = (array)get_post_meta( $id, 'sp_players', true ); $stats = (array)get_post_meta( $id, 'sp_players', true );
$statistic_labels = sportspress_get_var_labels( 'sp_statistic' ); $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 = ''; $output = '';
@@ -24,7 +28,7 @@ if ( !function_exists( 'sportspress_event_players' ) ) {
$output .= '<h3>' . get_the_title( $team_id ) . '</h3>'; $output .= '<h3>' . get_the_title( $team_id ) . '</h3>';
$output .= '<div class="sp-table-wrapper">' . $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">#</th>';
$output .= '<th class="data-number">' . __( 'Player', 'sportspress' ) . '</th>'; $output .= '<th class="data-number">' . __( 'Player', 'sportspress' ) . '</th>';
@@ -54,9 +58,12 @@ if ( !function_exists( 'sportspress_event_players' ) ) {
// Player number // Player number
$output .= '<td class="data-number">' . $number . '</td>'; $output .= '<td class="data-number">' . $number . '</td>';
// Name as link if ( $link_posts ):
$permalink = get_post_permalink( $player_id ); $permalink = get_post_permalink( $player_id );
$output .= '<td class="data-name">' . '<a href="' . $permalink . '">' . $name . '</a></td>'; $name = '<a href="' . $permalink . '">' . $name . '</a>';
endif;
$output .= '<td class="data-name">' . $name . '</td>';
foreach( $statistic_labels as $key => $label ): foreach( $statistic_labels as $key => $label ):
if ( $key == 'name' ) if ( $key == 'name' )
@@ -113,7 +120,7 @@ if ( !function_exists( 'sportspress_event_players' ) ) {
endforeach; 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 // Templates
require_once dirname( __FILE__ ) . '/admin/templates/countdown.php'; require_once dirname( __FILE__ ) . '/admin/templates/countdown.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-details.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-results.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-staff.php'; require_once dirname( __FILE__ ) . '/admin/templates/event-staff.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-venue.php'; require_once dirname( __FILE__ ) . '/admin/templates/event-venue.php';