Enable fronted table text align settings

This commit is contained in:
Brian Miyaji
2014-06-22 13:05:56 +10:00
parent f6315d35ef
commit bb2c727176
2 changed files with 41 additions and 26 deletions

View File

@@ -117,6 +117,19 @@ class SP_Settings_General extends SP_Settings_Page {
'checkboxgroup' => 'end', 'checkboxgroup' => 'end',
'desc_tip' => __( 'This will enable a script allowing the countdowns to be animated.', 'sportspress' ), 'desc_tip' => __( 'This will enable a script allowing the countdowns to be animated.', 'sportspress' ),
), ),
array(
'title' => __( 'Align', 'sportspress' ),
'id' => 'sportspress_table_text_align',
'default' => 'default',
'type' => 'radio',
'options' => array(
'default' => __( 'Default', 'sportspress' ),
'left' => __( 'Left', 'sportspress' ),
'center' => __( 'Center', 'sportspress' ),
'right' => __( 'Right', 'sportspress' ),
),
),
array( array(
'title' => __( 'Header Offset', 'sportspress' ), 'title' => __( 'Header Offset', 'sportspress' ),

View File

@@ -97,45 +97,47 @@ class SP_Frontend_Scripts {
$enabled = get_option( 'sportspress_enable_frontend_css', 'yes' ); $enabled = get_option( 'sportspress_enable_frontend_css', 'yes' );
$custom = get_option( 'sportspress_custom_css', null ); $custom = get_option( 'sportspress_custom_css', null );
$align = get_option( 'sportspress_table_text_align', 'default' );
$offset = get_option( 'sportspress_header_offset', '' ); $offset = get_option( 'sportspress_header_offset', '' );
if ( $offset === '' ) { if ( $offset === '' ) {
$template = get_option( 'template' ); $template = get_option( 'template' );
$offset = ( 'twentyfourteen' == $template ? 48 : 0 ); $offset = ( 'twentyfourteen' == $template ? 48 : 0 );
} }
if ( $enabled == 'yes' || ! empty( $custom ) || $offset != 0 ) { $colors = (array) get_option( 'sportspress_frontend_css_colors', array() );
echo '<style type="text/css">.sp-data-table tbody a,.sp-data-table tbody a:hover,.sp-calendar tbody a,.sp-calendar tbody a:hover{background:none;}';
$colors = (array) get_option( 'sportspress_frontend_css_colors', array() ); if ( $enabled == 'yes' && sizeof( $colors ) > 0 ) {
echo ' /* SportsPress Frontend CSS */ ';
echo '<style type="text/css">.sp-data-table tbody a,.sp-data-table tbody a:hover,.sp-calendar tbody a,.sp-calendar tbody a:hover{background:none;}';
if ( $enabled == 'yes' && sizeof( $colors ) > 0 ) { if ( isset( $colors['primary'] ) )
echo ' /* SportsPress Frontend CSS */ '; echo '.sp-data-table th,.sp-calendar th,.sp-data-table tfoot,.sp-calendar tfoot,.sp-button{background:' . $colors['primary'] . ' !important}.sp-data-table tbody a,.sp-calendar tbody a{color:' . $colors['primary'] . ' !important}';
if ( isset( $colors['primary'] ) ) if ( isset( $colors['background'] ) )
echo '.sp-data-table th,.sp-calendar th,.sp-data-table tfoot,.sp-calendar tfoot,.sp-button{background:' . $colors['primary'] . ' !important}.sp-data-table tbody a,.sp-calendar tbody a{color:' . $colors['primary'] . ' !important}'; echo '.sp-data-table tbody,.sp-calendar tbody{background: ' . $colors['background'] . ' !important}';
if ( isset( $colors['background'] ) ) if ( isset( $colors['text'] ) )
echo '.sp-data-table tbody,.sp-calendar tbody{background: ' . $colors['background'] . ' !important}'; echo '.sp-data-table tbody,.sp-calendar tbody{color: ' . $colors['text'] . ' !important}';
if ( isset( $colors['text'] ) ) if ( isset( $colors['heading'] ) )
echo '.sp-data-table tbody,.sp-calendar tbody{color: ' . $colors['text'] . ' !important}'; echo '.sp-data-table th,.sp-data-table th a,.sp-data-table tfoot,.sp-data-table tfoot a,.sp-calendar th,.sp-calendar th a,.sp-calendar tfoot,.sp-calendar tfoot a,.sp-button{color: ' . $colors['heading'] . ' !important}';
if ( isset( $colors['heading'] ) ) if ( isset( $colors['link'] ) )
echo '.sp-data-table th,.sp-data-table th a,.sp-data-table tfoot,.sp-data-table tfoot a,.sp-calendar th,.sp-calendar th a,.sp-calendar tfoot,.sp-calendar tfoot a,.sp-button{color: ' . $colors['heading'] . ' !important}'; echo '.sp-data-table tbody a,.sp-data-table tbody a:hover,.sp-calendar tbody a:focus{color: ' . $colors['link'] . ' !important}';
if ( isset( $colors['link'] ) )
echo '.sp-data-table tbody a,.sp-data-table tbody a:hover,.sp-calendar tbody a:focus{color: ' . $colors['link'] . ' !important}';
}
if ( $offset != 0 )
echo ' @media only screen and (min-width: 40.063em) {.sp-header{top: ' . $offset . 'px}}';
if ( ! empty( $custom ) )
echo ' /* SportsPress Custom CSS */ ' . $custom;
echo '</style>';
} }
if ( $align != 'default' )
echo '.sp-data-table th,.sp-data-table td{text-align: ' . $align . ' !important}';
if ( $offset != 0 )
echo ' @media only screen and (min-width: 40.063em) {.sp-header{top: ' . $offset . 'px}}';
if ( ! empty( $custom ) )
echo ' /* SportsPress Custom CSS */ ' . $custom;
echo '</style>';
} }
} }