diff --git a/includes/sp-template-functions.php b/includes/sp-template-functions.php
index 7439d15f..c73ffa9d 100644
--- a/includes/sp-template-functions.php
+++ b/includes/sp-template-functions.php
@@ -507,3 +507,76 @@ function sportspress_output_br_tag() {
get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
'link_venues' => get_option( 'sportspress_link_venues', 'yes' ) == 'yes' ? true : false,
'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
+ 'responsive' => get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false,
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
'paginated' => get_option( 'sportspress_event_list_paginated', 'yes' ) == 'yes' ? true : false,
@@ -91,13 +92,16 @@ if ( $show_title && false === $title && $id ):
else
$title = get_the_title( $id );
endif;
+$labels = array();
+//Create a unique identifier based on the current time in microseconds
+$identifier = uniqid( 'eventlist_' );
?>
| ' . __( 'Results', 'sportspress' ) . ' | '; } @@ -125,10 +130,11 @@ endif; break; default: if ( sp_column_active( $usecolumns, 'event' ) ) { - if ( $title_format == 'teams' ) + if ( $title_format == 'teams' ){ echo '' . __( 'Teams', 'sportspress' ) . ' | '; - else + } else { echo '' . __( 'Event', 'sportspress' ) . ' | '; + } } switch ( $time_format ) { @@ -241,17 +247,17 @@ endif; if ( $link_events ) $date_html = '' . $date_html . ''; - echo '' . $date_html . ' | '; + echo '' . $date_html . ' | '; switch ( $title_format ) { case 'homeaway': if ( sp_column_active( $usecolumns, 'event' ) ) { $team = array_shift( $teams_array ); - echo '' . $team . ' | '; + echo '' . $team . ' | '; } if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) { - echo ''; + echo ' | '; if ( $link_events ) echo ''; if ( ! empty( $main_results ) ): echo implode( ' - ', $main_results ); @@ -261,7 +267,7 @@ endif; if ( $link_events ) echo ''; echo ' | '; } elseif ( in_array( $time_format, array( 'separate', 'results' ) ) && sp_column_active( $usecolumns, 'results' ) ) { - echo ''; + echo ' | '; if ( $link_events ) echo ''; if ( ! empty( $main_results ) ): echo implode( ' - ', $main_results ); @@ -274,11 +280,11 @@ endif; if ( sp_column_active( $usecolumns, 'event' ) ) { $team = array_shift( $teams_array ); - echo ' | ' . $team . ' | '; + echo '' . $team . ' | '; } if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) { - echo ''; + echo ' | ';
if ( $link_events ) echo '';
echo ' | ' . $teams_output . ' | '; + echo '' . $teams_output . ' | '; } else { $title_html = implode( ' ', $team_logos ) . ' ' . $event->post_title; if ( $link_events ) $title_html = '' . $title_html . ''; - echo '' . $title_html . ' | '; + echo '' . $title_html . ' | '; } } switch ( $time_format ) { case 'separate': if ( sp_column_active( $usecolumns, 'time' ) ) { - echo ''; + echo ' | ';
if ( $link_events ) echo '';
echo ' | ';
}
if ( sp_column_active( $usecolumns, 'results' ) ) {
- echo ''; + echo ' | '; if ( $link_events ) echo ''; if ( ! empty( $main_results ) ): echo implode( ' - ', $main_results ); @@ -319,7 +325,7 @@ endif; break; case 'time': if ( sp_column_active( $usecolumns, 'time' ) ) { - echo ' | '; + echo ' | ';
if ( $link_events ) echo '';
echo ' | '; + echo ' | '; if ( $link_events ) echo ''; if ( ! empty( $main_results ) ): echo implode( ' - ', $main_results ); @@ -341,7 +347,7 @@ endif; break; default: if ( sp_column_active( $usecolumns, 'time' ) ) { - echo ' | '; + echo ' | '; if ( $link_events ) echo ''; if ( ! empty( $main_results ) ): echo implode( ' - ', $main_results ); @@ -355,7 +361,7 @@ endif; } if ( sp_column_active( $usecolumns, 'league' ) ): - echo ' | '; + echo ' | '; $leagues = get_the_terms( $event->ID, 'sp_league' ); if ( $leagues ): foreach ( $leagues as $league ): echo $league->name; @@ -364,7 +370,7 @@ endif; endif; if ( sp_column_active( $usecolumns, 'season' ) ): - echo ' | '; + echo ' | '; $seasons = get_the_terms( $event->ID, 'sp_season' ); if ( $seasons ): foreach ( $seasons as $season ): echo $season->name; @@ -373,7 +379,7 @@ endif; endif; if ( sp_column_active( $usecolumns, 'venue' ) ): - echo ' | '; + echo ' | '; if ( $link_venues ): the_terms( $event->ID, 'sp_venue' ); else: @@ -386,7 +392,7 @@ endif; endif; if ( sp_column_active( $usecolumns, 'article' ) ): - echo ' | '; + echo ' | '; if ( $link_events ) echo ''; if ( $video ): @@ -407,7 +413,7 @@ endif; endif; if ( sp_column_active( $usecolumns, 'day' ) ): - echo ' | '; + echo ' | '; $day = get_post_meta( $event->ID, 'sp_day', true ); if ( '' == $day ) { echo '-'; @@ -428,7 +434,12 @@ endif; |
|---|
| + + | @@ -84,7 +94,7 @@ if ( ! isset( $subs ) ) $subs = array(); $number = sp_array_value( $row, 'number', ' ' ); // Player number - echo '' . $number . ' | '; + echo '' . $number . ' | '; } if ( $link_posts ): @@ -167,7 +177,7 @@ if ( ! isset( $subs ) ) $subs = array(); endif; if ( $mode == 'values' ): - $content .= '' . $value . ' | '; + $content .= '' . $value . ' | '; elseif ( intval( $value ) && $mode == 'icons' ): $performance_id = sp_array_value( $performance_ids, $key, null ); $icons = ''; @@ -182,7 +192,7 @@ if ( ! isset( $subs ) ) $subs = array(); $name .= ' ' . $position . ''; endif; - echo '' . $name . ' | '; + echo '' . $name . ' | '; if ( $mode == 'icons' ): echo '' . $content . ' | '; @@ -208,10 +218,10 @@ if ( ! isset( $subs ) ) $subs = array(); '; + echo ''; } if ( $mode == 'values' ): - echo ' | ' . __( 'Total', 'sportspress' ) . ' | '; + echo '' . __( 'Total', 'sportspress' ) . ' | '; endif; endif; @@ -235,7 +245,11 @@ if ( ! isset( $subs ) ) $subs = array(); endif; if ( $mode == 'values' ): - echo '' . $value . ' | '; + if ($key == 'position'){ + echo '' . $value . ' | '; + }else{ + echo '' . $value . ' | '; + } elseif ( intval( $value ) && $mode == 'icons' ): $performance_id = sp_array_value( $performance_ids, $key, null ); $icons = ''; @@ -256,4 +270,4 @@ if ( ! isset( $subs ) ) $subs = array(); - + \ No newline at end of file diff --git a/templates/league-table.php b/templates/league-table.php index aa8112c6..499a97fc 100644 --- a/templates/league-table.php +++ b/templates/league-table.php @@ -19,6 +19,7 @@ $defaults = array( 'show_title' => get_option( 'sportspress_table_show_title', 'yes' ) == 'yes' ? true : false, 'show_team_logo' => get_option( 'sportspress_table_show_logos', 'yes' ) == 'yes' ? true : false, 'link_posts' => null, + 'responsive' => get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false, 'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false, 'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false, 'paginated' => get_option( 'sportspress_table_paginated', 'yes' ) == 'yes' ? true : false, @@ -47,6 +48,9 @@ if ( $show_title && false === $title && $id ): $title = get_the_title( $id ); endif; +//Create a unique identifier based on the current time in microseconds +$identifier = uniqid( 'table_' ); + $output = ''; if ( $title ) @@ -54,13 +58,16 @@ if ( $title ) $output .= '
|---|
| ' . sp_array_value( $row, 'pos' ) . ' | '; + $output .= '' . sp_array_value( $row, 'pos' ) . ' | '; $name_class = ''; @@ -149,13 +156,13 @@ foreach ( $data as $team_id => $row ): $name = '' . $name . ''; endif; - $output .= '' . $name . ' | '; + $output .= '' . $name . ' | '; foreach( $labels as $key => $value ): if ( in_array( $key, array( 'pos', 'name' ) ) ) continue; if ( ! is_array( $columns ) || in_array( $key, $columns ) ) - $output .= '' . sp_array_value( $row, $key, '—' ) . ' | '; + $output .= '' . sp_array_value( $row, $key, '—' ) . ' | '; endforeach; $output .= '' . ( $i + 1 ) . ' | '; + $tbody .= '' . ( $i + 1 ) . ' | '; else: - $tbody .= '' . sp_array_value( $row, 'number', ' ' ) . ' | '; + $tbody .= '' . sp_array_value( $row, 'number', ' ' ) . ' | '; endif; endif; @@ -162,7 +169,7 @@ foreach ( $groups as $group ): $name = '' . $name . ''; endif; - $tbody .= '' . $name . ' | '; + $tbody .= '' . $name . ' | '; if ( array_key_exists( 'team', $labels ) ): $team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_team', true ) ); @@ -170,7 +177,7 @@ foreach ( $groups as $group ): if ( $link_teams && false !== get_post_status( $team ) ): $team_name = '' . $team_name . ''; endif; - $tbody .= '' . $team_name . ' | '; + $tbody .= '' . $team_name . ' | '; endif; if ( array_key_exists( 'position', $labels ) ): @@ -181,14 +188,14 @@ foreach ( $groups as $group ): $position_term = get_term_by( 'id', $position, 'sp_position', ARRAY_A ); $positions = sp_array_value( $position_term, 'name', '—' ); endif; - $tbody .= '' . $positions . ' | '; + $tbody .= '' . $positions . ' | '; endif; foreach( $labels as $key => $value ): if ( in_array( $key, array( 'number', 'name', 'team', 'position' ) ) ) continue; if ( ! is_array( $columns ) || in_array( $key, $columns ) ) - $tbody .= '' . sp_array_value( $row, $key, '—' ) . ' | '; + $tbody .= '' . sp_array_value( $row, $key, '—' ) . ' | '; endforeach; $tbody .= ''; @@ -207,7 +214,7 @@ foreach ( $groups as $group ): endif; $output .= '