Simplify responsive styles to avoid theme-specific tweaks
This commit is contained in:
@@ -516,15 +516,14 @@ if ( ! function_exists( 'sportspress_responsive_tables_css' ) ) {
|
|||||||
* @subpackage Responsive
|
* @subpackage Responsive
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function sportspress_responsive_tables_css( $vars, $identity, $theme = null ) {
|
function sportspress_responsive_tables_css( $vars, $identity ) {
|
||||||
$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
|
||||||
and also iPads specifically.
|
and also iPads specifically.
|
||||||
*/
|
*/
|
||||||
@media
|
@media
|
||||||
only screen and (max-width: 760px),
|
only screen and (max-width: 800px) {
|
||||||
(min-device-width: 768px) and (max-device-width: 1024px) {
|
|
||||||
|
|
||||||
/* Force table to not be like tables anymore */
|
/* Force table to not be like tables anymore */
|
||||||
table.'.$identity.', table.'.$identity.' thead, table.'.$identity.' tbody, table.'.$identity.' th, table.'.$identity.' td, table.'.$identity.' tr {
|
table.'.$identity.', table.'.$identity.' thead, table.'.$identity.' tbody, table.'.$identity.' th, table.'.$identity.' td, table.'.$identity.' tr {
|
||||||
@@ -541,16 +540,14 @@ if ( ! function_exists( 'sportspress_responsive_tables_css' ) ) {
|
|||||||
width: auto !important;
|
width: auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sp-data-table [class*="data"] {
|
.sp-data-table th,
|
||||||
|
.sp-data-table td {
|
||||||
text-align: center !important;
|
text-align: center !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.'.$identity.' tr { border: 1px solid #ccc; }
|
|
||||||
|
|
||||||
table.'.$identity.' td {
|
table.'.$identity.' td {
|
||||||
/* Behave like a "row" */
|
/* Behave like a "row" */
|
||||||
border: none;
|
border: none;
|
||||||
border-bottom: 1px solid #eee;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-left: 50%;
|
padding-left: 50%;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
@@ -578,92 +575,6 @@ if ( ! function_exists( 'sportspress_responsive_tables_css' ) ) {
|
|||||||
$k++;
|
$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) {
|
|
||||||
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 '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 .= ' } ';
|
$custom_css .= ' } ';
|
||||||
|
|
||||||
$dummystyle = 'sportspress-style-inline-'.$identity;
|
$dummystyle = 'sportspress-style-inline-'.$identity;
|
||||||
|
|||||||
@@ -452,8 +452,7 @@ $identifier = uniqid( 'eventlist_' );
|
|||||||
<?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 ( true == $responsive ){
|
if ( true == $responsive ){
|
||||||
$theme_name = wp_get_theme()->get( 'Name' );
|
sportspress_responsive_tables_css( $labels, $identifier );
|
||||||
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>';
|
||||||
|
|||||||
@@ -268,6 +268,5 @@ $identifier = uniqid( 'performance_' );
|
|||||||
<?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 ( true == $responsive && $mode == 'values' ){
|
if ( true == $responsive && $mode == 'values' ){
|
||||||
$theme_name = wp_get_theme()->get( 'Name' );
|
sportspress_responsive_tables_css( $rlabels, $identifier );
|
||||||
sportspress_responsive_tables_css( $rlabels, $identifier, $theme_name );
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,8 +66,7 @@ $data = $table->data();
|
|||||||
$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 ( true == $responsive ){
|
if ( true == $responsive ){
|
||||||
$theme_name = wp_get_theme()->get( 'Name' );
|
sportspress_responsive_tables_css( $labels, $identifier );
|
||||||
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] );
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ $labels = $data[0];
|
|||||||
$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 ( true == $responsive ){
|
if ( true == $responsive ){
|
||||||
$theme_name = wp_get_theme()->get( 'Name' );
|
sportspress_responsive_tables_css( $labels, $identifier );
|
||||||
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