Merge remote-tracking branch 'origin/feature-responsive' into feature-responsive
This commit is contained in:
@@ -516,7 +516,7 @@ if ( ! function_exists( 'sportspress_responsive_tables_css' ) ) {
|
|||||||
* @subpackage Responsive
|
* @subpackage Responsive
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function sportspress_responsive_tables_css($vars,$identity) {
|
function sportspress_responsive_tables_css( $vars, $identity, $theme = null ) {
|
||||||
$custom_css = '/*
|
$custom_css = '/*
|
||||||
Max width before this PARTICULAR table gets nasty
|
Max width before this PARTICULAR table gets nasty
|
||||||
This query will take effect for any screen smaller than 760px
|
This query will take effect for any screen smaller than 760px
|
||||||
@@ -541,7 +541,7 @@ if ( ! function_exists( 'sportspress_responsive_tables_css' ) ) {
|
|||||||
width: auto !important;
|
width: auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sp-data-table .data-name {
|
.sp-data-table [class*="data"] {
|
||||||
text-align: center !important;
|
text-align: center !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -553,6 +553,7 @@ if ( ! function_exists( 'sportspress_responsive_tables_css' ) ) {
|
|||||||
border-bottom: 1px solid #eee;
|
border-bottom: 1px solid #eee;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-left: 50%;
|
padding-left: 50%;
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.'.$identity.' td:before {
|
table.'.$identity.' td:before {
|
||||||
@@ -565,20 +566,106 @@ if ( ! function_exists( 'sportspress_responsive_tables_css' ) ) {
|
|||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
/* Zebra striping */
|
|
||||||
|
/*
|
||||||
|
Label the data
|
||||||
|
*/
|
||||||
|
';
|
||||||
|
$k=1;
|
||||||
|
foreach ( $vars as $label ) {
|
||||||
|
$custom_css .= 'table.'.$identity.' td:nth-of-type('.$k.'):before { content: "'.$label.'"; }
|
||||||
|
';
|
||||||
|
$k++;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ( $theme ) {
|
||||||
|
|
||||||
|
case 'Emblem':
|
||||||
|
$custom_css .= '/* Zebra striping */
|
||||||
|
table.'.$identity.' tr:nth-of-type(odd) {
|
||||||
|
background: rgba(65, 166, 42, 0.25); !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*table.'.$identity.' tr:nth-of-type(even) {
|
||||||
|
background: rgb(30, 118, 19); !important;
|
||||||
|
}*/';
|
||||||
|
break;
|
||||||
|
case 'Courtside':
|
||||||
|
$custom_css .= '/* Zebra striping */
|
||||||
table.'.$identity.' tr:nth-of-type(odd) {
|
table.'.$identity.' tr:nth-of-type(odd) {
|
||||||
background: #eee !important;
|
background: #eee !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
table.'.$identity.' tr:nth-of-type(even) {
|
||||||
Label the data
|
background: #fff !important;
|
||||||
*/';
|
|
||||||
$k=1;
|
|
||||||
foreach ($vars as $label) {
|
|
||||||
$custom_css .= 'table.'.$identity.' td:nth-of-type('.$k.'):before { content: "'.$label.'"; }';
|
|
||||||
$k++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make the links visible */
|
||||||
|
.sp-data-table [class*="data"] a{
|
||||||
|
color: #0f8bca;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Small fix for padding */
|
||||||
|
table.'.$identity.' td:last-child {
|
||||||
|
padding-right: 0.25em;
|
||||||
|
}';
|
||||||
|
break;
|
||||||
|
case 'Premier':
|
||||||
|
$custom_css .= '/* Zebra striping */
|
||||||
|
table.'.$identity.' tr:nth-of-type(odd) {
|
||||||
|
background: #eee !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.'.$identity.' tr:nth-of-type(even) {
|
||||||
|
background: #fff !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make the links visible */
|
||||||
|
.sp-data-table [class*="data"] a{
|
||||||
|
color: #0f8bca;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Small fix for padding */
|
||||||
|
table.'.$identity.' td:last-child {
|
||||||
|
padding-right: 0.25em;
|
||||||
|
}';
|
||||||
|
break;
|
||||||
|
case 'Marquee':
|
||||||
|
$custom_css .= '/* Zebra striping */
|
||||||
|
table.'.$identity.' tr:nth-of-type(odd) {
|
||||||
|
background: #f3f3f3 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*table.'.$identity.' tr:nth-of-type(even) {
|
||||||
|
background: #fff !important;
|
||||||
|
}*/';
|
||||||
|
break;
|
||||||
|
case 'Rookie':
|
||||||
|
$custom_css .= '/* Zebra striping */
|
||||||
|
table.'.$identity.' tr:nth-of-type(odd) {
|
||||||
|
background: #eee !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.'.$identity.' tr:nth-of-type(even) {
|
||||||
|
background: #fff !important;
|
||||||
|
}';
|
||||||
|
break;
|
||||||
|
case 'Football Club':
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$custom_css .= '/* Zebra striping */
|
||||||
|
table.'.$identity.' tr:nth-of-type(odd) {
|
||||||
|
background: #eee !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.'.$identity.' tr:nth-of-type(even) {
|
||||||
|
background: #fff !important;
|
||||||
|
}';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$custom_css .= ' } ';
|
||||||
|
|
||||||
$dummystyle = 'sportspress-style-inline-'.$identity;
|
$dummystyle = 'sportspress-style-inline-'.$identity;
|
||||||
wp_register_style( $dummystyle, false );
|
wp_register_style( $dummystyle, false );
|
||||||
wp_enqueue_style( $dummystyle );
|
wp_enqueue_style( $dummystyle );
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ if ( $show_title && false === $title && $id ):
|
|||||||
endif;
|
endif;
|
||||||
$labels = array();
|
$labels = array();
|
||||||
//Create a unique identifier based on the current time in microseconds
|
//Create a unique identifier based on the current time in microseconds
|
||||||
$identifier = uniqid('eventlist_');
|
$identifier = uniqid( 'eventlist_' );
|
||||||
?>
|
?>
|
||||||
<div class="sp-template sp-template-event-list">
|
<div class="sp-template sp-template-event-list">
|
||||||
<?php if ( $title ) { ?>
|
<?php if ( $title ) { ?>
|
||||||
@@ -450,10 +450,10 @@ $identifier = uniqid('eventlist_');
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
//var_dump($labels);
|
|
||||||
// If responsive tables are enabled then load the inline css code
|
// If responsive tables are enabled then load the inline css code
|
||||||
if ($responsive == true){
|
if ( true == $responsive ){
|
||||||
sportspress_responsive_tables_css($labels,$identifier);
|
$theme_name = wp_get_theme()->get( 'Name' );
|
||||||
|
sportspress_responsive_tables_css( $labels, $identifier, $theme_name );
|
||||||
}
|
}
|
||||||
if ( $id && $show_all_events_link )
|
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>';
|
echo '<div class="sp-calendar-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a></div>';
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ if ( ! isset( $subs ) ) $subs = array();
|
|||||||
$responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false;
|
$responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false;
|
||||||
$rlabels = array();
|
$rlabels = array();
|
||||||
//Create a unique identifier based on the current time in microseconds
|
//Create a unique identifier based on the current time in microseconds
|
||||||
$identifier = uniqid('performance_');
|
$identifier = uniqid( 'performance_' );
|
||||||
?>
|
?>
|
||||||
<div class="sp-template sp-template-event-performance sp-template-event-performance-<?php echo $mode; ?><?php if ( isset( $class ) ) { echo ' ' . $class; } ?>">
|
<div class="sp-template sp-template-event-performance sp-template-event-performance-<?php echo $mode; ?><?php if ( isset( $class ) ) { echo ' ' . $class; } ?>">
|
||||||
<?php if ( $caption ): ?>
|
<?php if ( $caption ): ?>
|
||||||
@@ -267,6 +267,7 @@ $identifier = uniqid('performance_');
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
// If responsive tables are enabled then load the inline css code
|
// If responsive tables are enabled then load the inline css code
|
||||||
if ($responsive == true && $mode == 'values'){
|
if ( true == $responsive && $mode == 'values' ){
|
||||||
sportspress_responsive_tables_css($rlabels,$identifier);
|
$theme_name = wp_get_theme()->get( 'Name' );
|
||||||
|
sportspress_responsive_tables_css( $rlabels, $identifier, $theme_name );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ if ( $show_title && false === $title && $id ):
|
|||||||
endif;
|
endif;
|
||||||
|
|
||||||
//Create a unique identifier based on the current time in microseconds
|
//Create a unique identifier based on the current time in microseconds
|
||||||
$identifier = uniqid('table_');
|
$identifier = uniqid( 'table_' );
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
@@ -65,8 +65,9 @@ $data = $table->data();
|
|||||||
// The first row should be column labels
|
// The first row should be column labels
|
||||||
$labels = $data[0];
|
$labels = $data[0];
|
||||||
// If responsive tables are enabled then load the inline css code
|
// If responsive tables are enabled then load the inline css code
|
||||||
if ($responsive == true){
|
if ( true == $responsive ){
|
||||||
sportspress_responsive_tables_css($labels,$identifier);
|
$theme_name = wp_get_theme()->get( 'Name' );
|
||||||
|
sportspress_responsive_tables_css( $labels, $identifier, $theme_name );
|
||||||
}
|
}
|
||||||
// Remove the first row to leave us with the actual data
|
// Remove the first row to leave us with the actual data
|
||||||
unset( $data[0] );
|
unset( $data[0] );
|
||||||
@@ -178,7 +179,6 @@ $output .= '</div>';
|
|||||||
|
|
||||||
if ( $show_full_table_link )
|
if ( $show_full_table_link )
|
||||||
$output .= '<div class="sp-league-table-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View full table', 'sportspress' ) . '</a></div>';
|
$output .= '<div class="sp-league-table-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View full table', 'sportspress' ) . '</a></div>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="sp-template sp-template-league-table">
|
<div class="sp-template sp-template-league-table">
|
||||||
<?php echo $output; ?>
|
<?php echo $output; ?>
|
||||||
|
|||||||
@@ -57,10 +57,11 @@ $data = $list->data();
|
|||||||
// The first row should be column labels
|
// The first row should be column labels
|
||||||
$labels = $data[0];
|
$labels = $data[0];
|
||||||
//Create a unique identifier based on the current time in microseconds
|
//Create a unique identifier based on the current time in microseconds
|
||||||
$identifier = uniqid('playerlist_');
|
$identifier = uniqid( 'playerlist_' );
|
||||||
// If responsive tables are enabled then load the inline css code
|
// If responsive tables are enabled then load the inline css code
|
||||||
if ($responsive == true){
|
if ( true == $responsive ){
|
||||||
sportspress_responsive_tables_css($labels,$identifier);
|
$theme_name = wp_get_theme()->get( 'Name' );
|
||||||
|
sportspress_responsive_tables_css( $labels, $identifier, $theme_name );
|
||||||
}
|
}
|
||||||
// Remove the first row to leave us with the actual data
|
// Remove the first row to leave us with the actual data
|
||||||
unset( $data[0] );
|
unset( $data[0] );
|
||||||
|
|||||||
Reference in New Issue
Block a user