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

@@ -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_');
?>
<div class="sp-template sp-template-event-list">
<?php if ( $title ) { ?>
<h4 class="sp-table-caption"><?php echo $title; ?></h4>
<?php } ?>
<div class="sp-table-wrapper">
<table class="sp-event-list sp-event-list-format-<?php echo $title_format; ?> sp-data-table<?php if ( $paginated ) { ?> sp-paginated-table<?php } if ( $sortable ) { ?> sp-sortable-table<?php } if ( $responsive ) { ?> sp-responsive-table<?php } if ( $scrollable ) { ?> sp-scrollable-table<?php } ?>" data-sp-rows="<?php echo $rows; ?>">
<table class="sp-event-list sp-event-list-format-<?php echo $title_format; ?> sp-data-table<?php if ( $paginated ) { ?> sp-paginated-table<?php } if ( $sortable ) { ?> sp-sortable-table<?php } if ( $responsive ) { echo ' sp-responsive-table '.$identifier; } if ( $scrollable ) { ?> sp-scrollable-table <?php } ?>" data-sp-rows="<?php echo $rows; ?>">
<thead>
<tr>
<?php
@@ -451,7 +453,7 @@ $labels = array();
//var_dump($labels);
// 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);
}
if ( $id && $show_all_events_link )
echo '<div class="sp-calendar-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a></div>';