Check for sportspress-styles support to override SP support

This commit is contained in:
Brian Miyaji
2017-03-21 17:22:08 +11:00
parent 8d683a33a3
commit ec6a9b4f52

View File

@@ -1,6 +1,6 @@
<?php <?php
/* /*
Plugin Name: SportsPress Style Plugin Name: SportsPress Styles
Plugin URI: http://themeboy.com/ Plugin URI: http://themeboy.com/
Description: Add frontend styles to SportsPress. Description: Add frontend styles to SportsPress.
Author: ThemeBoy Author: ThemeBoy
@@ -11,15 +11,15 @@ Version: 2.2.4
// Exit if accessed directly // Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit; if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'SportsPress_Style' ) ) : if ( ! class_exists( 'SportsPress_Styles' ) ) :
/** /**
* Main SportsPress Style Class * Main SportsPress Styles Class
* *
* @class SportsPress_Style * @class SportsPress_Styles
* @version 2.2.4 * @version 2.2.4
*/ */
class SportsPress_Style { class SportsPress_Styles {
/** /**
* Constructor * Constructor
@@ -56,7 +56,8 @@ class SportsPress_Style {
* Add option. * Add option.
*/ */
public static function add_option( $options = array() ) { public static function add_option( $options = array() ) {
if ( ! current_theme_supports( 'sportspress' ) ): if ( current_theme_supports( 'sportspress' ) && ! current_theme_supports( 'sportspress-styles' ) ) return $options;
array_unshift( $options, array( array_unshift( $options, array(
'title' => __( 'Frontend Styles', 'sportspress' ), 'title' => __( 'Frontend Styles', 'sportspress' ),
'desc' => __( 'Enable', 'sportspress' ), 'desc' => __( 'Enable', 'sportspress' ),
@@ -64,7 +65,7 @@ class SportsPress_Style {
'default' => 'yes', 'default' => 'yes',
'type' => 'checkbox', 'type' => 'checkbox',
) ); ) );
endif;
return $options; return $options;
} }
@@ -72,7 +73,7 @@ class SportsPress_Style {
* Add stylesheet. * Add stylesheet.
*/ */
public static function add_styles( $styles = array() ) { public static function add_styles( $styles = array() ) {
if ( current_theme_supports( 'sportspress' ) ) return $styles; if ( current_theme_supports( 'sportspress' ) && ! current_theme_supports( 'sportspress-styles' ) ) return $styles;
if ( 'no' === get_option( 'sportspress_styles', 'yes' ) ) return $styles; if ( 'no' === get_option( 'sportspress_styles', 'yes' ) ) return $styles;
$styles['sportspress-roboto'] = array( $styles['sportspress-roboto'] = array(
@@ -112,7 +113,7 @@ class SportsPress_Style {
* Output custom CSS. * Output custom CSS.
*/ */
public function custom_css( $colors = array() ) { public function custom_css( $colors = array() ) {
if ( current_theme_supports( 'sportspress' ) ) return $styles; if ( current_theme_supports( 'sportspress' ) && ! current_theme_supports( 'sportspress-styles' ) ) return $styles;
if ( 'no' === get_option( 'sportspress_styles', 'yes' ) ) return $styles; if ( 'no' === get_option( 'sportspress_styles', 'yes' ) ) return $styles;
// Defaults // Defaults
@@ -159,4 +160,4 @@ class SportsPress_Style {
endif; endif;
new SportsPress_Style(); new SportsPress_Styles();