diff --git a/includes/sp-template-functions.php b/includes/sp-template-functions.php index 40b3fae2..90e834f4 100644 --- a/includes/sp-template-functions.php +++ b/includes/sp-template-functions.php @@ -516,7 +516,7 @@ if ( ! function_exists( 'sportspress_responsive_tables_css' ) ) { * @subpackage Responsive * @return void */ - function sportspress_responsive_tables_css($vars) { + function sportspress_responsive_tables_css($vars,$identity) { $custom_css = '/* Max width before this PARTICULAR table gets nasty This query will take effect for any screen smaller than 760px @@ -527,12 +527,12 @@ if ( ! function_exists( 'sportspress_responsive_tables_css' ) ) { (min-device-width: 768px) and (max-device-width: 1024px) { /* Force table to not be like tables anymore */ - table.sp-responsive-table, table.sp-responsive-table thead, table.sp-responsive-table tbody, table.sp-responsive-table th, table.sp-responsive-table td, table.sp-responsive-table tr { + table.'.$identity.', table.'.$identity.' thead, table.'.$identity.' tbody, table.'.$identity.' th, table.'.$identity.' td, table.'.$identity.' tr { display: block; } /* Hide table headers (but not display: none;, for accessibility) */ - table.sp-responsive-table thead tr { + table.'.$identity.' thead tr { position: absolute; top: -9999px; left: -9999px; @@ -545,9 +545,9 @@ if ( ! function_exists( 'sportspress_responsive_tables_css' ) ) { text-align: center !important; } - table.sp-responsive-table tr { border: 1px solid #ccc; } + table.'.$identity.' tr { border: 1px solid #ccc; } - table.sp-responsive-table td { + table.'.$identity.' td { /* Behave like a "row" */ border: none; border-bottom: 1px solid #eee; @@ -555,7 +555,7 @@ if ( ! function_exists( 'sportspress_responsive_tables_css' ) ) { padding-left: 50%; } - table.sp-responsive-table td:before { + table.'.$identity.' td:before { /* Now like a table header */ position: absolute; /* Top/left values mimic padding */ @@ -566,7 +566,7 @@ if ( ! function_exists( 'sportspress_responsive_tables_css' ) ) { white-space: nowrap; } /* Zebra striping */ - table.sp-responsive-table tr:nth-of-type(odd) { + table.'.$identity.' tr:nth-of-type(odd) { background: #eee !important; } @@ -575,13 +575,13 @@ if ( ! function_exists( 'sportspress_responsive_tables_css' ) ) { */'; $k=1; foreach ($vars as $label) { - $custom_css .= 'table.sp-responsive-table td:nth-of-type('.$k.'):before { content: "'.$label.'"; }'; + $custom_css .= 'table.'.$identity.' td:nth-of-type('.$k.'):before { content: "'.$label.'"; }'; $k++; } - - wp_register_style( 'sportspress-style-inline', false ); - wp_enqueue_style( 'sportspress-style-inline' ); - wp_add_inline_style( 'sportspress-style-inline', $custom_css ); + $dummystyle = 'sportspress-style-inline-'.$identity; + wp_register_style( $dummystyle, false ); + wp_enqueue_style( $dummystyle ); + wp_add_inline_style( $dummystyle, $custom_css ); } } \ No newline at end of file diff --git a/templates/event-list.php b/templates/event-list.php index 20cd448e..9fb86771 100644 --- a/templates/event-list.php +++ b/templates/event-list.php @@ -93,13 +93,15 @@ if ( $show_title && false === $title && $id ): $title = get_the_title( $id ); endif; $labels = array(); +//Create a unique identifier based on the current time in microseconds +$identifier = uniqid('eventlist_'); ?>

- +
' . __( 'View all events', 'sportspress' ) . ''; diff --git a/templates/event-performance-table.php b/templates/event-performance-table.php index b06ce250..3b130985 100644 --- a/templates/event-performance-table.php +++ b/templates/event-performance-table.php @@ -22,13 +22,15 @@ if ( ! isset( $lineups ) ) $lineups = array(); if ( ! isset( $subs ) ) $subs = array(); $responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false; $rlabels = array(); +//Create a unique identifier based on the current time in microseconds +$identifier = uniqid('performance_'); ?>

-
+
@@ -266,5 +268,5 @@ $rlabels = array(); '; -$output .= '
' . '' . ''; +$output .= '
' . '' . ''; $data = $table->data(); @@ -63,7 +66,7 @@ $data = $table->data(); $labels = $data[0]; // If responsive tables are enabled then load the inline css code if ($responsive == true){ - sportspress_responsive_tables_css($labels); + sportspress_responsive_tables_css($labels,$identifier); } // Remove the first row to leave us with the actual data unset( $data[0] ); diff --git a/templates/player-list.php b/templates/player-list.php index 78ab90f2..cc145375 100644 --- a/templates/player-list.php +++ b/templates/player-list.php @@ -56,9 +56,11 @@ $data = $list->data(); // The first row should be column labels $labels = $data[0]; +//Create a unique identifier based on the current time in microseconds +$identifier = uniqid('playerlist_'); // If responsive tables are enabled then load the inline css code if ($responsive == true){ - sportspress_responsive_tables_css($labels); + sportspress_responsive_tables_css($labels,$identifier); } // Remove the first row to leave us with the actual data unset( $data[0] ); @@ -211,7 +213,7 @@ foreach ( $groups as $group ): endif; $output .= '
' . - '
' . '' . ''; + '
' . '' . ''; if ( ! is_array( $labels ) || array_key_exists( 'number', $labels ) ): if ( in_array( $orderby, array( 'number', 'name' ) ) ):