From d1876ee9af1adea997e0bec7d47cf7ddc0cfd57d Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Sun, 22 Jun 2014 22:35:48 +1000 Subject: [PATCH] Add table padding setting to general options --- .../admin/settings/class-sp-settings-general.php | 13 +++++++++++++ includes/class-sp-frontend-scripts.php | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/includes/admin/settings/class-sp-settings-general.php b/includes/admin/settings/class-sp-settings-general.php index fb1ff2e2..f4cd6817 100644 --- a/includes/admin/settings/class-sp-settings-general.php +++ b/includes/admin/settings/class-sp-settings-general.php @@ -95,6 +95,19 @@ class SP_Settings_General extends SP_Settings_Page { 'right' => __( 'Right', 'sportspress' ), ), ), + + array( + 'title' => __( 'Padding', 'sportspress' ), + 'id' => 'sportspress_table_padding', + 'class' => 'small-text', + 'default' => null, + 'placeholder' => __( 'Auto', 'sportspress' ), + 'desc' => 'px', + 'type' => 'number', + 'custom_attributes' => array( + 'step' => 1 + ), + ), array( 'title' => __( 'Custom CSS', 'sportspress' ), diff --git a/includes/class-sp-frontend-scripts.php b/includes/class-sp-frontend-scripts.php index ce7897bb..1b3afa23 100644 --- a/includes/class-sp-frontend-scripts.php +++ b/includes/class-sp-frontend-scripts.php @@ -98,6 +98,7 @@ class SP_Frontend_Scripts { $custom = get_option( 'sportspress_custom_css', null ); $align = get_option( 'sportspress_table_text_align', 'default' ); + $padding = get_option( 'sportspress_table_padding', null ); $offset = get_option( 'sportspress_header_offset', '' ); if ( $offset === '' ) { @@ -131,6 +132,9 @@ class SP_Frontend_Scripts { if ( $align != 'default' ) echo '.sp-data-table th,.sp-data-table td{text-align: ' . $align . ' !important}'; + if ( $padding != null ) + echo '.sp-data-table th,.sp-data-table td{padding: ' . $padding . 'px !important}'; + if ( $offset != 0 ) echo ' @media only screen and (min-width: 40.063em) {.sp-header{top: ' . $offset . 'px}}';