Use gettext filter to modify fronted text

This commit is contained in:
Brian Miyaji
2014-06-13 23:21:59 +10:00
parent 89ce3ee84e
commit 5ba33fd629
21 changed files with 90 additions and 124 deletions

View File

@@ -43,14 +43,16 @@ class SP_Settings_Text extends SP_Settings_Page {
); );
$strings = sp_get_text_options(); $strings = sp_get_text_options();
$options = get_option( 'sportspress_text' );
foreach ( $strings as $key => $value ): foreach ( $strings as $string ):
$settings[] = array( $settings[] = array(
'title' => $value, 'title' => $string,
'id' => 'sportspress_' . $key . '_text', 'id' => 'sportspress_text[' . $string . ']',
'default' => '', 'default' => '',
'placeholder' => $value, 'placeholder' => $string,
'type' => 'text', 'value' => sp_array_value( $options, $string, null ),
'type' => 'text',
); );
endforeach; endforeach;
@@ -58,6 +60,14 @@ class SP_Settings_Text extends SP_Settings_Page {
return apply_filters( 'sportspress_text_settings', $settings ); // End event settings return apply_filters( 'sportspress_text_settings', $settings ); // End event settings
} }
/**
* Save settings
*/
public function save() {
if ( isset( $_POST['sportspress_text'] ) )
update_option( 'sportspress_text', $_POST['sportspress_text'] );
}
} }
endif; endif;

View File

@@ -316,7 +316,7 @@ class SP_League_Table extends SP_Custom_Post{
unset( $columns[ $key ] ); unset( $columns[ $key ] );
endif; endif;
endforeach; endforeach;
$labels = array_merge( array( 'name' => SP()->text->string('Team') ), $columns ); $labels = array_merge( array( 'name' => __( 'Team', 'sportspress' ) ), $columns );
$merged[0] = $labels; $merged[0] = $labels;
return $merged; return $merged;
endif; endif;

View File

@@ -358,7 +358,7 @@ class SP_Player_List extends SP_Custom_Post {
endif; endif;
endforeach; endforeach;
$labels = array( 'name' => SP()->text->string('Player') ); $labels = array( 'name' => __( 'Player', 'sportspress' ) );
if ( in_array( 'team', $this->columns ) ) if ( in_array( 'team', $this->columns ) )
$labels['team'] = __( 'Team', 'sportspress' ); $labels['team'] = __( 'Team', 'sportspress' );

View File

@@ -316,7 +316,7 @@ class SP_Player extends SP_Custom_Post {
unset( $columns[ $key ] ); unset( $columns[ $key ] );
endif; endif;
endforeach; endforeach;
$labels = array_merge( array( 'name' => SP()->text->string('Season'), 'team' => SP()->text->string('Team') ), $columns ); $labels = array_merge( array( 'name' => __( 'Season', 'sportspress' ), 'team' => __( 'Team', 'sportspress' ) ), $columns );
$merged[0] = $labels; $merged[0] = $labels;
return $merged; return $merged;
endif; endif;

View File

@@ -252,7 +252,7 @@ class SP_Team extends SP_Custom_Post {
if ( $admin ): if ( $admin ):
return array( $columns, $data, $placeholders, $merged, $leagues_seasons ); return array( $columns, $data, $placeholders, $merged, $leagues_seasons );
else: else:
$labels = array_merge( array( 'name' => SP()->text->string('Season') ), $columns ); $labels = array_merge( array( 'name' => __( 'Season', 'sportspress' ) ), $columns );
$merged[0] = $labels; $merged[0] = $labels;
return $merged; return $merged;
endif; endif;

View File

@@ -1,49 +0,0 @@
<?php
/**
* SportsPress text
*
* The SportsPress text class stores editable strings.
*
* @class SP_Text
* @version 0.8
* @package SportsPress/Classes
* @category Class
* @author ThemeBoy
*/
class SP_Text {
/** @var array Array of text */
public $data;
/**
* Constructor for the text class - defines all editable strings.
*
* @access public
* @return void
*/
public function __construct() {
$this->data = sp_get_text_options();
}
public function __get( $key ) {
return ( array_key_exists( $key, $this->data ) ? $this->data[ $key ] : null );
}
public function __set( $key, $value ){
$this->data[ $key ] = $value;
}
public function string( $string ){
if ( is_admin() )
return $string;
$key = str_replace( '-', '_', sanitize_title( $string ) );
if ( array_key_exists( $key, $this->data ) ):
$string = get_option( 'sportspress_' . $key . '_text' );
return ( empty( $string ) ? $this->data[ $key ] : $string );
else:
return $string;
endif;
}
}

View File

@@ -2387,35 +2387,35 @@ function sp_get_sport_presets() {
*/ */
function sp_get_text_options() { function sp_get_text_options() {
$strings = apply_filters( 'sportspress_text', array( $strings = apply_filters( 'sportspress_text', array(
'article' => __( 'Article', 'sportspress' ), __( 'Article', 'sportspress' ),
'current_team' => __( 'Current Team', 'sportspress' ), __( 'Current Team', 'sportspress' ),
'date' => __( 'Date', 'sportspress' ), __( 'Date', 'sportspress' ),
'details' => __( 'Details', 'sportspress' ), __( 'Details', 'sportspress' ),
'event' => __( 'Event', 'sportspress' ), __( 'Event', 'sportspress' ),
'league' => __( 'League', 'sportspress' ), __( 'League', 'sportspress' ),
'nationality' => __( 'Nationality', 'sportspress' ), __( 'Nationality', 'sportspress' ),
'outcome' => __( 'Outcome', 'sportspress' ), __( 'Outcome', 'sportspress' ),
'past_teams' => __( 'Past Teams', 'sportspress' ), __( 'Past Teams', 'sportspress' ),
'played' => __( 'Played', 'sportspress' ), __( 'Played', 'sportspress' ),
'player' => __( 'Player', 'sportspress' ), __( 'Player', 'sportspress' ),
'pos' => __( 'Pos', 'sportspress' ), __( 'Pos', 'sportspress' ),
'position' => __( 'Position', 'sportspress' ), __( 'Position', 'sportspress' ),
'preview' => __( 'Preview', 'sportspress' ), __( 'Preview', 'sportspress' ),
'rank' => __( 'Rank', 'sportspress' ), __( 'Rank', 'sportspress' ),
'recap' => __( 'Recap', 'sportspress' ), __( 'Recap', 'sportspress' ),
'team_results' => __( 'Team Results', 'sportspress' ), __( 'Team Results', 'sportspress' ),
'season' => __( 'Season', 'sportspress' ), __( 'Season', 'sportspress' ),
'staff' => __( 'Staff', 'sportspress' ), __( 'Staff', 'sportspress' ),
'substitutes' => __( 'Substitutes', 'sportspress' ), __( 'Substitutes', 'sportspress' ),
'team' => __( 'Team', 'sportspress' ), __( 'Team', 'sportspress' ),
'teams' => __( 'Teams', 'sportspress' ), __( 'Teams', 'sportspress' ),
'time' => __( 'Time', 'sportspress' ), __( 'Time', 'sportspress' ),
'timeresults' => __( 'Time/Results', 'sportspress' ), __( 'Time/Results', 'sportspress' ),
'total' => __( 'Total', 'sportspress' ), __( 'Total', 'sportspress' ),
'venue' => __( 'Venue', 'sportspress' ), __( 'Venue', 'sportspress' ),
'view_all_events' => __( 'View all events', 'sportspress' ), __( 'View all events', 'sportspress' ),
'view_all_players' => __( 'View all players', 'sportspress' ), __( 'View all players', 'sportspress' ),
'view_full_table' => __( 'View full table', 'sportspress' ), __( 'View full table', 'sportspress' ),
)); ));
asort( $strings ); asort( $strings );
return $strings; return $strings;

View File

@@ -190,7 +190,11 @@ function sportspress_gettext( $translated_text, $untranslated_text, $domain ) {
endswitch; endswitch;
endif; endif;
else: else:
if ( ! current_theme_supports( 'sportspress' ) && $untranslated_text == 'Archives' && is_tax( 'sp_venue' ) ): if ( $domain == 'sportspress' ):
if ( ! empty( SP()->text[ $untranslated_text ] ) ):
$translated_text = SP()->text[ $untranslated_text ];
endif;
elseif ( ! current_theme_supports( 'sportspress' ) && $untranslated_text == 'Archives' && is_tax( 'sp_venue' ) ):
$slug = get_query_var( 'sp_venue' ); $slug = get_query_var( 'sp_venue' );
if ( $slug ): if ( $slug ):
$venue = get_term_by( 'slug', $slug, 'sp_venue' ); $venue = get_term_by( 'slug', $slug, 'sp_venue' );

View File

@@ -52,9 +52,9 @@ final class SportsPress {
public $formats = null; public $formats = null;
/** /**
* @var SP_Text $text * @var array
*/ */
public $text = null; public $text = array();
/** /**
* Main SportsPress Instance * Main SportsPress Instance
@@ -211,7 +211,6 @@ final class SportsPress {
// Classes (used on all pages) // Classes (used on all pages)
include_once( 'includes/class-sp-countries.php' ); // Defines continents and countries include_once( 'includes/class-sp-countries.php' ); // Defines continents and countries
include_once( 'includes/class-sp-formats.php' ); // Defines custom post type formats include_once( 'includes/class-sp-formats.php' ); // Defines custom post type formats
include_once( 'includes/class-sp-text.php' ); // Defines editable strings
// Include template hooks in time for themes to remove/modify them // Include template hooks in time for themes to remove/modify them
include_once( 'includes/sp-template-hooks.php' ); include_once( 'includes/sp-template-hooks.php' );
@@ -261,7 +260,9 @@ final class SportsPress {
// Load class instances // Load class instances
$this->countries = new SP_Countries(); // Countries class $this->countries = new SP_Countries(); // Countries class
$this->formats = new SP_Formats(); // Formats class $this->formats = new SP_Formats(); // Formats class
$this->text = new SP_Text(); // Text class
// Load string options
$this->text = get_option( 'sportspress_text', array() );
// Init action // Init action
do_action( 'sportspress_init' ); do_action( 'sportspress_init' );

View File

@@ -102,5 +102,5 @@ if ( isset( $columns ) )
</div> </div>
<?php <?php
if ( $id && $show_all_events_link ) if ( $id && $show_all_events_link )
echo '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all events') . '</a>'; echo '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a>';
?> ?>

View File

@@ -209,6 +209,6 @@ if ( $pad != 0 && $pad != 7 )
$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>\n\t</div>"; $calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>\n\t</div>";
if ( $id && $show_all_events_link ) if ( $id && $show_all_events_link )
$calendar_output .= '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all events') . '</a>'; $calendar_output .= '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a>';
echo apply_filters( 'sportspress_event_calendar', $calendar_output ); echo apply_filters( 'sportspress_event_calendar', $calendar_output );

View File

@@ -17,19 +17,19 @@ $time = get_the_time( get_option('time_format'), $id );
$leagues = get_the_terms( $id, 'sp_league' ); $leagues = get_the_terms( $id, 'sp_league' );
$seasons = get_the_terms( $id, 'sp_season' ); $seasons = get_the_terms( $id, 'sp_season' );
$data = array( SP()->text->string('Date') => $date, SP()->text->string('Time') => $time ); $data = array( __( 'Date', 'sportspress' ) => $date, __( 'Time', 'sportspress' ) => $time );
if ( $leagues ): if ( $leagues ):
$league = array_pop( $leagues ); $league = array_pop( $leagues );
$data[ SP()->text->string('League') ] = $league->name; $data[ __( 'League', 'sportspress' ) ] = $league->name;
endif; endif;
if ( $seasons ): if ( $seasons ):
$season = array_pop( $seasons ); $season = array_pop( $seasons );
$data[ SP()->text->string('Season') ] = $season->name; $data[ __( 'Season', 'sportspress' ) ] = $season->name;
endif; endif;
?> ?>
<h3><?php echo SP()->text->string('Details'); ?></h3> <h3><?php echo __( 'Details', 'sportspress' ); ?></h3>
<div class="sp-table-wrapper sp-scrollable-table-wrapper"> <div class="sp-table-wrapper sp-scrollable-table-wrapper">
<table class="sp-event-details sp-data-table"> <table class="sp-event-details sp-data-table">
<thead> <thead>

View File

@@ -42,22 +42,22 @@ if ( isset( $columns ) )
<thead> <thead>
<tr> <tr>
<?php <?php
echo '<th class="data-date">' . SP()->text->string('Date') . '</th>'; echo '<th class="data-date">' . __( 'Date', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'event', $usecolumns ) ) if ( $usecolumns == null || in_array( 'event', $usecolumns ) )
echo '<th class="data-event">' . SP()->text->string('Event') . '</th>'; echo '<th class="data-event">' . __( 'Event', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'teams', $usecolumns ) ) if ( $usecolumns == null || in_array( 'teams', $usecolumns ) )
echo '<th class="data-teams">' . SP()->text->string('Teams') . '</th>'; echo '<th class="data-teams">' . __( 'Teams', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'time', $usecolumns ) ) if ( $usecolumns == null || in_array( 'time', $usecolumns ) )
echo '<th class="data-time">' . SP()->text->string('Time/Results') . '</th>'; echo '<th class="data-time">' . __( 'Time/Results', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'venue', $usecolumns ) ) if ( $usecolumns == null || in_array( 'venue', $usecolumns ) )
echo '<th class="data-venue">' . SP()->text->string('Venue') . '</th>'; echo '<th class="data-venue">' . __( 'Venue', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'article', $usecolumns ) ) if ( $usecolumns == null || in_array( 'article', $usecolumns ) )
echo '<th class="data-article">' . SP()->text->string('Article') . '</th>'; echo '<th class="data-article">' . __( 'Article', 'sportspress' ) . '</th>';
?> ?>
</tr> </tr>
</thead> </thead>
@@ -160,9 +160,9 @@ if ( isset( $columns ) )
endif; endif;
if ( $event->post_content !== null ): if ( $event->post_content !== null ):
if ( $event->post_status == 'publish' ): if ( $event->post_status == 'publish' ):
echo SP()->text->string('Recap'); echo __( 'Recap', 'sportspress' );
else: else:
echo SP()->text->string('Preview'); echo __( 'Preview', 'sportspress' );
endif; endif;
endif; endif;
@@ -180,5 +180,5 @@ if ( isset( $columns ) )
</div> </div>
<?php <?php
if ( $id && $show_all_events_link ) if ( $id && $show_all_events_link )
echo '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all events') . '</a>'; echo '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a>';
?> ?>

View File

@@ -47,7 +47,7 @@ foreach( $teams as $key => $team_id ):
<tr> <tr>
<?php if ( $has_players ): ?> <?php if ( $has_players ): ?>
<th class="data-number">#</th> <th class="data-number">#</th>
<th class="data-name"><?php echo SP()->text->string('Player'); ?></th> <th class="data-name"><?php echo __( 'Player'), 'sportspress' ; ?></th>
<?php endif; foreach( $performance_labels as $key => $label ): ?> <?php endif; foreach( $performance_labels as $key => $label ): ?>
<th class="data-<?php echo $key; ?>"><?php echo $label; ?></th> <th class="data-<?php echo $key; ?>"><?php echo $label; ?></th>
<?php endforeach; ?> <?php endforeach; ?>
@@ -130,7 +130,7 @@ foreach( $teams as $key => $team_id ):
<?php <?php
if ( $has_players ): if ( $has_players ):
echo '<td class="data-number">&nbsp;</td>'; echo '<td class="data-number">&nbsp;</td>';
echo '<td class="data-name">' . SP()->text->string('Total') . '</td>'; echo '<td class="data-name">' . __( 'Total', 'sportspress' ) . '</td>';
endif; endif;
$row = $data[0]; $row = $data[0];

View File

@@ -83,16 +83,16 @@ if ( empty( $table_rows ) ):
else: else:
$output .= '<h3>' . SP()->text->string('Team Results') . '</h3>'; $output .= '<h3>' . __( 'Team Results', 'sportspress' ) . '</h3>';
$output .= '<div class="sp-table-wrapper sp-scrollable-table-wrapper">' . $output .= '<div class="sp-table-wrapper sp-scrollable-table-wrapper">' .
'<table class="sp-event-results sp-data-table sp-responsive-table"><thead>' . '<table class="sp-event-results sp-data-table sp-responsive-table"><thead>' .
'<th class="data-name">' . SP()->text->string('Team') . '</th>'; '<th class="data-name">' . __( 'Team', 'sportspress' ) . '</th>';
foreach( $result_labels as $key => $label ): foreach( $result_labels as $key => $label ):
$output .= '<th class="data-' . $key . '">' . $label . '</th>'; $output .= '<th class="data-' . $key . '">' . $label . '</th>';
endforeach; endforeach;
if ( $show_outcomes ): if ( $show_outcomes ):
$output .= '<th class="data-outcome">' . SP()->text->string('Outcome') . '</th>'; $output .= '<th class="data-outcome">' . __( 'Outcome', 'sportspress' ) . '</th>';
endif; endif;
$output .= '</tr>' . '</thead>' . '<tbody>'; $output .= '</tr>' . '</thead>' . '<tbody>';
$output .= $table_rows; $output .= $table_rows;

View File

@@ -32,7 +32,7 @@ foreach( $venues as $venue ):
$latitude = sp_array_value( $meta, 'sp_latitude', 0 ); $latitude = sp_array_value( $meta, 'sp_latitude', 0 );
$longitude = sp_array_value( $meta, 'sp_longitude', 0 ); $longitude = sp_array_value( $meta, 'sp_longitude', 0 );
?> ?>
<h3><?php echo SP()->text->string('Venue'); ?></h3> <h3><?php _e( 'Venue', 'sportspress' ); ?></h3>
<table class="sp-data-table sp-event-venue"> <table class="sp-data-table sp-event-venue">
<thead> <thead>
<tr> <tr>

View File

@@ -46,7 +46,7 @@ if ( ! $columns )
if ( ! is_array( $columns ) ) if ( ! is_array( $columns ) )
$columns = explode( ',', $columns ); $columns = explode( ',', $columns );
$output .= '<th class="data-rank">' . SP()->text->string('Pos') . '</th>'; $output .= '<th class="data-rank">' . __( 'Pos', 'sportspress' ) . '</th>';
foreach( $labels as $key => $label ): foreach( $labels as $key => $label ):
if ( ! is_array( $columns ) || $key == 'name' || in_array( $key, $columns ) ) if ( ! is_array( $columns ) || $key == 'name' || in_array( $key, $columns ) )
@@ -107,6 +107,6 @@ $output .= '</tbody>' . '</table>';
$output .= '</div>'; $output .= '</div>';
if ( $show_full_table_link ) if ( $show_full_table_link )
$output .= '<a class="sp-league-table-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View full table') . '</a>'; $output .= '<a class="sp-league-table-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View full table', 'sportspress' ) . '</a>';
echo $output; echo $output;

View File

@@ -31,7 +31,7 @@ $metrics_after = $player->metrics( false );
$common = array(); $common = array();
if ( $nationality ): if ( $nationality ):
$country_name = sp_array_value( $countries, $nationality, null ); $country_name = sp_array_value( $countries, $nationality, null );
$common[ SP()->text->string('Nationality') ] = $country_name ? ( $show_nationality_flags ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '&mdash;'; $common[ __( 'Nationality', 'sportspress' ) ] = $country_name ? ( $show_nationality_flags ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '&mdash;';
endif; endif;
$data = array_merge( $metrics_before, $common, $metrics_after ); $data = array_merge( $metrics_before, $common, $metrics_after );
@@ -50,7 +50,7 @@ if ( $past_teams ):
foreach ( $past_teams as $team ): foreach ( $past_teams as $team ):
$teams[] = '<a href="' . get_post_permalink( $team ) . '">' . get_the_title( $team ) . '</a>'; $teams[] = '<a href="' . get_post_permalink( $team ) . '">' . get_the_title( $team ) . '</a>';
endforeach; endforeach;
$data[ SP()->text->string('Past Teams') ] = implode( ', ', $teams ); $data[ __( 'Past Teams', 'sportspress' ) ] = implode( ', ', $teams );
endif; endif;
$output = '<div class="sp-list-wrapper">' . $output = '<div class="sp-list-wrapper">' .

View File

@@ -142,4 +142,4 @@ endforeach;
echo "</div>\n"; echo "</div>\n";
if ( $show_all_players_link ) if ( $show_all_players_link )
echo '<a class="sp-player-list-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all players') . '</a>'; echo '<a class="sp-player-list-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all players', 'sportspress' ) . '</a>';

View File

@@ -85,7 +85,7 @@ foreach ( $groups as $group ):
if ( in_array( $orderby, array( 'number', 'name' ) ) ): if ( in_array( $orderby, array( 'number', 'name' ) ) ):
$output .= '<th class="data-number">#</th>'; $output .= '<th class="data-number">#</th>';
else: else:
$output .= '<th class="data-rank">' . SP()->text->string('Rank') . '</th>'; $output .= '<th class="data-rank">' . __( 'Rank', 'sportspress' ) . '</th>';
endif; endif;
foreach( $labels as $key => $label ): foreach( $labels as $key => $label ):
@@ -153,6 +153,6 @@ foreach ( $groups as $group ):
endforeach; endforeach;
if ( $show_all_players_link ) if ( $show_all_players_link )
$output .= '<a class="sp-player-list-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all players') . '</a>'; $output .= '<a class="sp-player-list-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all players', 'sportspress' ) . '</a>';
echo apply_filters( 'sportspress_player_list', $output ); echo apply_filters( 'sportspress_player_list', $output );

View File

@@ -29,18 +29,18 @@ $past_teams = $staff->past_teams();
$data = array(); $data = array();
if ( $nationality ): if ( $nationality ):
$country_name = sp_array_value( $countries, $nationality, null ); $country_name = sp_array_value( $countries, $nationality, null );
$data[ SP()->text->string('Nationality') ] = $country_name ? ( $show_nationality_flags ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '&mdash;'; $data[ __( 'Nationality', 'sportspress' ) ] = $country_name ? ( $show_nationality_flags ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '&mdash;';
endif; endif;
if ( $current_team ) if ( $current_team )
$data[ SP()->text->string('Current Team') ] = '<a href="' . get_post_permalink( $current_team ) . '">' . get_the_title( $current_team ) . '</a>'; $data[ __( 'Current Team', 'sportspress' ) ] = '<a href="' . get_post_permalink( $current_team ) . '">' . get_the_title( $current_team ) . '</a>';
if ( $past_teams ): if ( $past_teams ):
$teams = array(); $teams = array();
foreach ( $past_teams as $team ): foreach ( $past_teams as $team ):
$teams[] = '<a href="' . get_post_permalink( $team ) . '">' . get_the_title( $team ) . '</a>'; $teams[] = '<a href="' . get_post_permalink( $team ) . '">' . get_the_title( $team ) . '</a>';
endforeach; endforeach;
$data[ SP()->text->string('Past Teams') ] = implode( ', ', $teams ); $data[ __( 'Past Teams', 'sportspress' ) ] = implode( ', ', $teams );
endif; endif;
$output = '<div class="sp-list-wrapper">' . $output = '<div class="sp-list-wrapper">' .