Reorder frontend CSS colors

This commit is contained in:
Brian Miyaji
2014-05-11 03:43:49 +10:00
parent 30194f904e
commit 4cffef9b60
3 changed files with 26 additions and 20 deletions

View File

@@ -124,17 +124,17 @@ class SP_Settings_General extends SP_Settings_Page {
// Save settings
$primary = ( ! empty( $_POST['sportspress_frontend_css_primary'] ) ) ? sp_format_hex( $_POST['sportspress_frontend_css_primary'] ) : '';
$heading = ( ! empty( $_POST['sportspress_frontend_css_heading'] ) ) ? sp_format_hex( $_POST['sportspress_frontend_css_heading'] ) : '';
$text = ( ! empty( $_POST['sportspress_frontend_css_text'] ) ) ? sp_format_hex( $_POST['sportspress_frontend_css_text'] ) : '';
$link = ( ! empty( $_POST['sportspress_frontend_css_link'] ) ) ? sp_format_hex( $_POST['sportspress_frontend_css_link'] ) : '';
$background = ( ! empty( $_POST['sportspress_frontend_css_background'] ) ) ? sp_format_hex( $_POST['sportspress_frontend_css_background'] ) : '';
$text = ( ! empty( $_POST['sportspress_frontend_css_text'] ) ) ? sp_format_hex( $_POST['sportspress_frontend_css_text'] ) : '';
$heading = ( ! empty( $_POST['sportspress_frontend_css_heading'] ) ) ? sp_format_hex( $_POST['sportspress_frontend_css_heading'] ) : '';
$link = ( ! empty( $_POST['sportspress_frontend_css_link'] ) ) ? sp_format_hex( $_POST['sportspress_frontend_css_link'] ) : '';
$colors = array(
'primary' => $primary,
'heading' => $heading,
'text' => $text,
'background' => $background,
'link' => $link
'text' => $text,
'heading' => $heading,
'link' => $link,
);
update_option( 'sportspress_frontend_css_colors', $colors );
@@ -183,17 +183,17 @@ class SP_Settings_General extends SP_Settings_Page {
// Defaults
if ( empty( $colors['primary'] ) ) $colors['primary'] = '#00a69c';
if ( empty( $colors['background'] ) ) $colors['background'] = '#f4f4f4';
if ( empty( $colors['text'] ) ) $colors['text'] = '#363f48';
if ( empty( $colors['heading'] ) ) $colors['heading'] = '#ffffff';
if ( empty( $colors['text'] ) ) $colors['text'] = '#222222';
if ( empty( $colors['background'] ) ) $colors['background'] = '#f5f5f5';
if ( empty( $colors['link'] ) ) $colors['link'] = '#00a69c';
if ( empty( $colors['link'] ) ) $colors['link'] = '#ef6848';
// Show inputs
$this->color_picker( __( 'Primary', 'sportspress' ), 'sportspress_frontend_css_primary', $colors['primary'] );
$this->color_picker( __( 'Heading', 'sportspress' ), 'sportspress_frontend_css_heading', $colors['heading'] );
$this->color_picker( __( 'Text', 'sportspress' ), 'sportspress_frontend_css_text', $colors['text'] );
$this->color_picker( __( 'Link', 'sportspress' ), 'sportspress_frontend_css_link', $colors['link'] );
$this->color_picker( __( 'Background', 'sportspress' ), 'sportspress_frontend_css_background', $colors['background'] );
$this->color_picker( __( 'Text', 'sportspress' ), 'sportspress_frontend_css_text', $colors['text'] );
$this->color_picker( __( 'Heading', 'sportspress' ), 'sportspress_frontend_css_heading', $colors['heading'] );
$this->color_picker( __( 'Link', 'sportspress' ), 'sportspress_frontend_css_link', $colors['link'] );
?><br>
<label for="sportspress_enable_frontend_css">

View File

@@ -86,6 +86,12 @@ class SP_Frontend_Scripts {
}
}
/**
* Output custom CSS.
*
* @access public
* @return void
*/
public function custom_css() {
$enabled = get_option( 'sportspress_enable_frontend_css', 'yes' );
$custom = get_option( 'sportspress_custom_css', null );
@@ -102,17 +108,17 @@ class SP_Frontend_Scripts {
if ( isset( $colors['primary'] ) )
echo '.sp-data-table th,.sp-calendar th,.sp-data-table tfoot,.sp-calendar tfoot{background:' . $colors['primary'] . ' !important}.sp-data-table tbody a,.sp-calendar tbody a{color:' . $colors['primary'] . ' !important}';
if ( isset( $colors['heading'] ) )
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{color: ' . $colors['heading'] . ' !important}';
if ( isset( $colors['background'] ) )
echo '.sp-data-table tbody,.sp-calendar tbody{background: ' . $colors['background'] . ' !important}';
if ( isset( $colors['text'] ) )
echo '.sp-data-table tbody,.sp-calendar tbody{color: ' . $colors['text'] . ' !important}';
if ( isset( $colors['heading'] ) )
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{color: ' . $colors['heading'] . ' !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 ( isset( $colors['background'] ) )
echo '.sp-data-table tbody,.sp-calendar tbody{background: ' . $colors['background'] . ' !important}';
}
if ( ! empty( $custom ) )

View File

@@ -127,10 +127,10 @@ class SP_Install {
// Default color scheme
add_option( 'sportspress_frontend_css_primary', '#00a69c' );
add_option( 'sportspress_frontend_css_background', '#f4f4f4' );
add_option( 'sportspress_frontend_css_text', '#363f48' );
add_option( 'sportspress_frontend_css_heading', '#ffffff' );
add_option( 'sportspress_frontend_css_text', '#222222' );
add_option( 'sportspress_frontend_css_link', '#00a69c' );
add_option( 'sportspress_frontend_css_background', '#f5f5f5' );
add_option( 'sportspress_frontend_css_link', '#ef6848' );
if ( ! get_option( 'sportspress_installed' ) ) {
// Configure default sport