Add default frontend stylesheet
This commit is contained in:
@@ -36,7 +36,6 @@
|
|||||||
.sp-player-list .data-name .player-flag {
|
.sp-player-list .data-name .player-flag {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
margin-left: 0.5em;
|
margin-left: 0.5em;
|
||||||
float: right;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Event Calendar */
|
/* Event Calendar */
|
||||||
|
|||||||
218
assets/css/sportspress-style.css
Normal file
218
assets/css/sportspress-style.css
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
/* SportsPress Templates */
|
||||||
|
|
||||||
|
.sp-template {
|
||||||
|
font-family: "Roboto", "Helvetica", sans-serif !important;
|
||||||
|
margin-bottom: 20px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-template *,
|
||||||
|
.sp-data-table * {
|
||||||
|
text-transform: none !important;
|
||||||
|
letter-spacing: normal !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Headings */
|
||||||
|
|
||||||
|
.sp-table-caption {
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 15px !important;
|
||||||
|
background: #fff !important;
|
||||||
|
border: 1px solid #e5e5e5 !important;
|
||||||
|
border-bottom: none !important;
|
||||||
|
font-size: 20px !important;
|
||||||
|
font-weight: 400 !important;
|
||||||
|
line-height: 1.5 !important;
|
||||||
|
display: table !important;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Links */
|
||||||
|
|
||||||
|
.sp-template a,
|
||||||
|
.sp-data-table a {
|
||||||
|
box-shadow: none !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
color: #00a69c !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-template a:hover,
|
||||||
|
.sp-data-table a:hover {
|
||||||
|
text-decoration: underline !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-view-all-link {
|
||||||
|
padding: 10px 15px !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
background: #fff !important;
|
||||||
|
border: 1px solid #e5e5e5 !important;
|
||||||
|
border-top: none !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
display: table !important;
|
||||||
|
width: 100% !important;
|
||||||
|
text-align: right !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-view-all-link a {
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 400 !important;
|
||||||
|
line-height: 1.5 !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
color: #999 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-view-all-link a:hover {
|
||||||
|
color: #333 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-form-event-link:hover {
|
||||||
|
text-decoration: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Images */
|
||||||
|
|
||||||
|
.sp-template img {
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tables */
|
||||||
|
|
||||||
|
.sp-data-table {
|
||||||
|
color: #333 !important;
|
||||||
|
background: #fff !important;
|
||||||
|
border-collapse: collapse !important;
|
||||||
|
border: 1px solid #e5e5e5 !important;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-data-table th,
|
||||||
|
.sp-data-table td {
|
||||||
|
font-size: 13px !important;
|
||||||
|
font-weight: 400 !important;
|
||||||
|
line-height: 1.5 !important;
|
||||||
|
border: 1px solid #e5e5e5 !important;
|
||||||
|
padding: 5px 10px !important;
|
||||||
|
text-align: center !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-data-table th {
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
color: #999 !important;
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-data-table .data-name {
|
||||||
|
text-align: left !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-data-table .sp-highlight,
|
||||||
|
.sp-data-table .highlighted td {
|
||||||
|
font-weight: 500 !important;
|
||||||
|
background: #f9f9f9 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Galleries */
|
||||||
|
|
||||||
|
.sp-template-gallery .sp-gallery-wrapper {
|
||||||
|
border: 1px solid #e5e5e5 !important;
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-template-gallery .gallery-item {
|
||||||
|
padding: 0 !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
position: relative !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-template-gallery .gallery-item a {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-template-gallery .gallery-caption {
|
||||||
|
padding: 0 !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-style: normal !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
text-align: center !important;
|
||||||
|
color: #999 !important;
|
||||||
|
line-height: 1.5 !important;
|
||||||
|
padding: 5px 10px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-template-gallery .gallery-caption strong {
|
||||||
|
color: #fff !important;
|
||||||
|
background: #00a69c !important;
|
||||||
|
display: block !important;
|
||||||
|
font-weight: 400 !important;
|
||||||
|
font-size: 13px !important;
|
||||||
|
position: absolute !important;
|
||||||
|
left: 0 !important;
|
||||||
|
top: 0 !important;
|
||||||
|
padding: 5px 10px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Countdowns */
|
||||||
|
|
||||||
|
.sp-template-countdown h3,
|
||||||
|
.sp-template-countdown h5 {
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 5px 10px !important;
|
||||||
|
text-align: center !important;
|
||||||
|
line-height: 1.5 !important;
|
||||||
|
display: table !important;
|
||||||
|
width: 100% !important;
|
||||||
|
border: 1px solid #e5e5e5 !important;
|
||||||
|
border-bottom: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-template-countdown h3 {
|
||||||
|
font-size: 13px !important;
|
||||||
|
font-weight: 400 !important;
|
||||||
|
color: #333 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-template-countdown h5 {
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
color: #999 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-template-countdown h5 a {
|
||||||
|
color: inherit !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-countdown time {
|
||||||
|
display: table !important;
|
||||||
|
border: 1px solid #e5e5e5 !important;
|
||||||
|
border-collapse: collapse !important;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-countdown span {
|
||||||
|
font-size: 20px !important;
|
||||||
|
font-weight: 400 !important;
|
||||||
|
line-height: 1.5 !important;
|
||||||
|
display: table-cell !important;
|
||||||
|
border: 1px solid #e5e5e5 !important;
|
||||||
|
padding: 10px 5px !important;
|
||||||
|
text-align: center !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-countdown span small {
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 400 !important;
|
||||||
|
line-height: 1.5 !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
color: #999 !important;
|
||||||
|
color: #999 !important;
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Media Queries */
|
||||||
|
|
||||||
|
@media screen and (min-width: 801px) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 601px) {
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
/* Templates */
|
/* Templates */
|
||||||
.sp-template {
|
.sp-template {
|
||||||
margin-bottom: 1.5em;
|
margin-bottom: 1.5em;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.sp-template-profile-selector {
|
.sp-template-profile-selector {
|
||||||
clear: both;
|
clear: both;
|
||||||
@@ -180,8 +181,8 @@
|
|||||||
width: 2em;
|
width: 2em;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
display: block;
|
display: inline-block;
|
||||||
float: left;
|
vertical-align: middle;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.sp-league-table .data-name .team-logo img {
|
.sp-league-table .data-name .team-logo img {
|
||||||
@@ -200,8 +201,8 @@
|
|||||||
width: 2em;
|
width: 2em;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
display: block;
|
display: inline-block;
|
||||||
float: left;
|
vertical-align: middle;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.sp-player-list .data-name .player-photo img,
|
.sp-player-list .data-name .player-photo img,
|
||||||
@@ -422,17 +423,18 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sp-form-event-link {
|
.sp-form-events .sp-form-event-link {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
line-height: 1.5em;
|
||||||
width: 1.5em;
|
width: 1.5em;
|
||||||
margin: 0 0 0.25em;
|
margin: 0 0 0.25em;
|
||||||
color: #fff;
|
color: #fff !important;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sp-form-event-link:hover {
|
.sp-form-events .sp-form-event-link:hover {
|
||||||
color: #fff;
|
color: #fff !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Countdowns */
|
/* Countdowns */
|
||||||
@@ -481,11 +483,6 @@
|
|||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alternate */
|
|
||||||
.sp-data-table tbody tr.odd {
|
|
||||||
background: rgba(0, 0, 0, 0.02);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Highlight & Heading */
|
/* Highlight & Heading */
|
||||||
.sp-highlight,
|
.sp-highlight,
|
||||||
.sp-heading {
|
.sp-heading {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class SP_Settings_General extends SP_Settings_Page {
|
|||||||
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
||||||
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
||||||
add_action( 'sportspress_admin_field_timezone', array( $this, 'timezone_setting' ) );
|
add_action( 'sportspress_admin_field_timezone', array( $this, 'timezone_setting' ) );
|
||||||
add_action( 'sportspress_admin_field_frontend_styles', array( $this, 'frontend_styles_setting' ) );
|
add_action( 'sportspress_admin_field_colors', array( $this, 'colors_setting' ) );
|
||||||
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ class SP_Settings_General extends SP_Settings_Page {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$options = array(
|
$options = array(
|
||||||
array( 'type' => 'frontend_styles' ),
|
array( 'type' => 'colors' ),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( ( $styles = SP_Frontend_Scripts::get_styles() ) && array_key_exists( 'sportspress-general', $styles ) ):
|
if ( ( $styles = SP_Frontend_Scripts::get_styles() ) && array_key_exists( 'sportspress-general', $styles ) ):
|
||||||
@@ -294,7 +294,7 @@ class SP_Settings_General extends SP_Settings_Page {
|
|||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function frontend_styles_setting() {
|
public function colors_setting() {
|
||||||
// Define color schemes each with 5 colors: Primary, Background, Text, Heading, Link
|
// Define color schemes each with 5 colors: Primary, Background, Text, Heading, Link
|
||||||
$color_schemes = apply_filters( 'sportspress_color_schemes', array(
|
$color_schemes = apply_filters( 'sportspress_color_schemes', array(
|
||||||
'ThemeBoy' => array( '2b353e', 'f4f4f4', '222222', 'ffffff', '00a69c' ),
|
'ThemeBoy' => array( '2b353e', 'f4f4f4', '222222', 'ffffff', '00a69c' ),
|
||||||
@@ -308,7 +308,7 @@ class SP_Settings_General extends SP_Settings_Page {
|
|||||||
) );
|
) );
|
||||||
?><tr valign="top" class="themeboy">
|
?><tr valign="top" class="themeboy">
|
||||||
<th scope="row" class="titledesc">
|
<th scope="row" class="titledesc">
|
||||||
<?php _e( 'Frontend Styles', 'sportspress' ); ?>
|
<?php _e( 'Color Scheme', 'sportspress' ); ?>
|
||||||
</th>
|
</th>
|
||||||
<td class="forminp">
|
<td class="forminp">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
|||||||
@@ -423,6 +423,10 @@ class SP_Install {
|
|||||||
update_option( 'sportspress_staff_template_order', $layout );
|
update_option( 'sportspress_staff_template_order', $layout );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( version_compare( $version, '2.2', '<' ) ) {
|
||||||
|
update_option( 'sportspress_frontend_styles', 'no' );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
136
modules/sportspress-style.php
Normal file
136
modules/sportspress-style.php
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
Plugin Name: SportsPress Style
|
||||||
|
Plugin URI: http://themeboy.com/
|
||||||
|
Description: Add frontend styles to SportsPress.
|
||||||
|
Author: ThemeBoy
|
||||||
|
Author URI: http://themeboy.com/
|
||||||
|
Version: 2.1.7
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Exit if accessed directly
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||||
|
|
||||||
|
if ( ! class_exists( 'SportsPress_Style' ) ) :
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main SportsPress Style Class
|
||||||
|
*
|
||||||
|
* @class SportsPress_Style
|
||||||
|
* @version 2.1.7
|
||||||
|
*/
|
||||||
|
class SportsPress_Style {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
// Define constants
|
||||||
|
$this->define_constants();
|
||||||
|
|
||||||
|
// Add option
|
||||||
|
add_filter( 'sportspress_script_styling_options', array( $this, 'add_option' ) );
|
||||||
|
|
||||||
|
// Add stylesheet
|
||||||
|
add_filter( 'sportspress_enqueue_styles', array( $this, 'add_styles' ), 20 );
|
||||||
|
|
||||||
|
// Output custom CSS
|
||||||
|
add_action( 'sportspress_frontend_css', array( $this, 'custom_css' ), 40 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define constants.
|
||||||
|
*/
|
||||||
|
private function define_constants() {
|
||||||
|
if ( !defined( 'SP_STYLE_VERSION' ) )
|
||||||
|
define( 'SP_STYLE_VERSION', '2.1.7' );
|
||||||
|
|
||||||
|
if ( !defined( 'SP_STYLE_URL' ) )
|
||||||
|
define( 'SP_STYLE_URL', plugin_dir_url( __FILE__ ) );
|
||||||
|
|
||||||
|
if ( !defined( 'SP_STYLE_DIR' ) )
|
||||||
|
define( 'SP_STYLE_DIR', plugin_dir_path( __FILE__ ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add option.
|
||||||
|
*/
|
||||||
|
public static function add_option( $options = array() ) {
|
||||||
|
if ( ! current_theme_supports( 'sportspress' ) ):
|
||||||
|
array_unshift( $options, array(
|
||||||
|
'title' => __( 'Frontend Styles', 'sportspress' ),
|
||||||
|
'desc' => __( 'Enable', 'sportspress' ),
|
||||||
|
'id' => 'sportspress_styles',
|
||||||
|
'default' => 'yes',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
) );
|
||||||
|
endif;
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add stylesheet.
|
||||||
|
*/
|
||||||
|
public static function add_styles( $styles = array() ) {
|
||||||
|
if ( current_theme_supports( 'sportspress' ) ) return $styles;
|
||||||
|
if ( 'no' === get_option( 'sportspress_styles', 'yes' ) ) return $styles;
|
||||||
|
|
||||||
|
$styles['sportspress-style'] = array(
|
||||||
|
'src' => str_replace( array( 'http:', 'https:' ), '', SP()->plugin_url() ) . '/assets/css/sportspress-style.css',
|
||||||
|
'deps' => '',
|
||||||
|
'version' => SP_STYLE_VERSION,
|
||||||
|
'media' => 'all'
|
||||||
|
);
|
||||||
|
return $styles;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output custom CSS.
|
||||||
|
*/
|
||||||
|
public function custom_css( $colors = array() ) {
|
||||||
|
if ( current_theme_supports( 'sportspress' ) ) return $styles;
|
||||||
|
if ( 'no' === get_option( 'sportspress_styles', 'yes' ) ) return $styles;
|
||||||
|
|
||||||
|
// Defaults
|
||||||
|
if ( empty( $colors['primary'] ) ) $colors['primary'] = '#2b353e';
|
||||||
|
if ( empty( $colors['background'] ) ) $colors['background'] = '#f4f4f4';
|
||||||
|
if ( empty( $colors['text'] ) ) $colors['text'] = '#222222';
|
||||||
|
if ( empty( $colors['heading'] ) ) $colors['heading'] = '#ffffff';
|
||||||
|
if ( empty( $colors['link'] ) ) $colors['link'] = '#00a69c';
|
||||||
|
|
||||||
|
// Calculate primary variations
|
||||||
|
$colors['primary_border'] = sp_hex_darker( $colors['primary'], 26, true );
|
||||||
|
|
||||||
|
// Calculate background variations
|
||||||
|
$colors['background_highlight'] = sp_hex_darker( $colors['background'], 6, true );
|
||||||
|
$colors['background_border'] = sp_hex_darker( $colors['background'], 26, true );
|
||||||
|
|
||||||
|
// Calculate text variations
|
||||||
|
$rgb = sp_rgb_from_hex( $colors['text'] );
|
||||||
|
$colors['text_muted'] = sp_hex_lighter( $colors['text'], 102, true );
|
||||||
|
|
||||||
|
// Primary
|
||||||
|
echo '.sp-data-table th,.sp-template-gallery .gallery-caption{background:' . $colors['primary'] . ' !important}';
|
||||||
|
echo '.sp-data-table th{border-color:' . $colors['primary_border'] . ' !important}';
|
||||||
|
|
||||||
|
// Background
|
||||||
|
echo '.sp-table-caption,.sp-template .sp-view-all-link{background:' . $colors['background'] . ' !important}';
|
||||||
|
echo '.sp-table-caption,.sp-data-table,.sp-data-table td,.sp-template .sp-view-all-link{border-color:' . $colors['background_border'] . ' !important}';
|
||||||
|
echo '.sp-data-table .sp-highlight,.sp-data-table .highlighted td{background:' . $colors['background_highlight'] . ' !important}';
|
||||||
|
|
||||||
|
// Text
|
||||||
|
echo '.sp-table-caption,.sp-template .sp-view-all-link a:hover{color:' . $colors['text'] . ' !important}';
|
||||||
|
echo '.sp-template .sp-view-all-link a{color:' . $colors['text_muted'] . ' !important}';
|
||||||
|
|
||||||
|
// Heading
|
||||||
|
echo '.sp-data-table th,.sp-template-gallery .gallery-caption{color:' . $colors['heading'] . ' !important}';
|
||||||
|
|
||||||
|
// Link
|
||||||
|
echo '.sp-template a{color:' . $colors['link'] . ' !important}';
|
||||||
|
echo '.sp-template-gallery .gallery-caption strong{background:' . $colors['link'] . ' !important}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
endif;
|
||||||
|
|
||||||
|
new SportsPress_Style();
|
||||||
Reference in New Issue
Block a user