Apply align and padding settings only if styled

This commit is contained in:
Brian Miyaji
2014-06-26 18:30:43 +10:00
parent 7bea8db8f9
commit 171a4604fd
2 changed files with 34 additions and 28 deletions

View File

@@ -40,8 +40,7 @@ class SP_Settings_General extends SP_Settings_Page {
$presets = SP_Admin_Sports::get_preset_options(); $presets = SP_Admin_Sports::get_preset_options();
return apply_filters( 'sportspress_general_settings', array( $settings = array(
array( 'title' => __( 'General Options', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'general_options' ), array( 'title' => __( 'General Options', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'general_options' ),
array( 'type' => 'country' ), array( 'type' => 'country' ),
@@ -82,33 +81,39 @@ class SP_Settings_General extends SP_Settings_Page {
array( 'title' => __( 'Styles and Scripts', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'script_styling_options' ), array( 'title' => __( 'Styles and Scripts', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'script_styling_options' ),
array( 'type' => 'frontend_styles' ), array( 'type' => 'frontend_styles' ),
);
array( if ( ( $styles = SP_Frontend_Scripts::get_styles() ) && array_key_exists( 'sportspress-general', $styles ) ):
'title' => __( 'Align', 'sportspress' ), $settings = array_merge( $settings, array(
'id' => 'sportspress_table_text_align', array(
'default' => 'default', 'title' => __( 'Align', 'sportspress' ),
'type' => 'radio', 'id' => 'sportspress_table_text_align',
'options' => array( 'default' => 'default',
'default' => __( 'Default', 'sportspress' ), 'type' => 'radio',
'left' => __( 'Left', 'sportspress' ), 'options' => array(
'center' => __( 'Center', 'sportspress' ), 'default' => __( 'Default', 'sportspress' ),
'right' => __( 'Right', 'sportspress' ), 'left' => __( 'Left', 'sportspress' ),
'center' => __( 'Center', 'sportspress' ),
'right' => __( 'Right', 'sportspress' ),
),
), ),
),
array(
array( 'title' => __( 'Padding', 'sportspress' ),
'title' => __( 'Padding', 'sportspress' ), 'id' => 'sportspress_table_padding',
'id' => 'sportspress_table_padding', 'class' => 'small-text',
'class' => 'small-text', 'default' => null,
'default' => null, 'placeholder' => __( 'Auto', 'sportspress' ),
'placeholder' => __( 'Auto', 'sportspress' ), 'desc' => 'px',
'desc' => 'px', 'type' => 'number',
'type' => 'number', 'custom_attributes' => array(
'custom_attributes' => array( 'step' => 1
'step' => 1 ),
), ),
), ));
endif;
$settings = array_merge( $settings, array(
array( array(
'title' => __( 'Custom CSS', 'sportspress' ), 'title' => __( 'Custom CSS', 'sportspress' ),
'id' => 'sportspress_custom_css', 'id' => 'sportspress_custom_css',
@@ -158,8 +163,9 @@ class SP_Settings_General extends SP_Settings_Page {
), ),
array( 'type' => 'sectionend', 'id' => 'script_styling_options' ), array( 'type' => 'sectionend', 'id' => 'script_styling_options' ),
));
)); // End general settings
return apply_filters( 'sportspress_general_settings', $settings ); // End general settings
} }
/** /**

View File

@@ -30,7 +30,7 @@ class SP_Frontend_Scripts {
'version' => SP_VERSION, 'version' => SP_VERSION,
'media' => 'all' 'media' => 'all'
), ),
) ); ));
} }
/** /**