Target specific tables by adding a unique class name

Using the uniqid function of PHP (http://www.php.net/manual/en/function.uniqid.php)
This commit is contained in:
savvasha
2017-11-30 19:43:50 +02:00
parent a7ff15ff59
commit 8d2b504fb8
5 changed files with 29 additions and 20 deletions

View File

@@ -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_');
?>
<div class="sp-template sp-template-event-performance sp-template-event-performance-<?php echo $mode; ?><?php if ( isset( $class ) ) { echo ' ' . $class; } ?>">
<?php if ( $caption ): ?>
<h4 class="sp-table-caption"><?php echo $caption; ?></h4>
<?php endif; ?>
<div class="sp-table-wrapper">
<table class="sp-event-performance sp-data-table<?php if ( $mode == 'values' ) { ?><?php if ( $scrollable ) { ?> sp-scrollable-table<?php }if ( $responsive ) { ?> sp-responsive-table<?php } ?><?php if ( $sortable ) { ?> sp-sortable-table<?php } ?><?php } ?>">
<table class="sp-event-performance sp-data-table<?php if ( $mode == 'values' ) { ?><?php if ( $scrollable ) { ?> sp-scrollable-table<?php }if ( $responsive ) { echo ' sp-responsive-table '.$identifier; } if ( $sortable ) { ?> sp-sortable-table<?php } ?><?php } ?>">
<thead>
<tr>
<?php if ( $mode == 'values' ): ?>
@@ -266,5 +268,5 @@ $rlabels = array();
<?php
// If responsive tables are enabled then load the inline css code
if ($responsive == true && $mode == 'values'){
sportspress_responsive_tables_css($rlabels);
sportspress_responsive_tables_css($rlabels,$identifier);
}