From 2e3bf818bac15f69ea24237bf8f445beb63d34a0 Mon Sep 17 00:00:00 2001 From: Nate Wright Date: Fri, 26 Feb 2016 13:50:22 +0000 Subject: [PATCH 1/3] Don't add show_advanced_fonts control if theme doesn't define them --- customizer.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/customizer.php b/customizer.php index d559096..4b15a43 100644 --- a/customizer.php +++ b/customizer.php @@ -283,11 +283,6 @@ public function theme_font_customizer( $wp_customize ) { } - } - - if( !$has_panel ){ - $this->display_inputs( $theme_font_locations, $wp_customize ); - } else{ $wp_customize->add_setting( 'show_advanced_fonts', array( 'transport' => 'postMessage' ) @@ -301,6 +296,11 @@ public function theme_font_customizer( $wp_customize ) { 'section' => 'theme_fonts_main', ) ); + + } + + if( !$has_panel ){ + $this->display_inputs( $theme_font_locations, $wp_customize ); } } @@ -477,4 +477,4 @@ public function customizer_live_preview(){ } -$typecase_customizer = Typecase_Customizer::init(); \ No newline at end of file +$typecase_customizer = Typecase_Customizer::init(); From 340d82f2575d1326215f6722d5e22db62f7e3bac Mon Sep 17 00:00:00 2001 From: Nate Wright Date: Fri, 26 Feb 2016 14:20:03 +0000 Subject: [PATCH 2/3] Allow default fonts to specify a title --- customizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/customizer.php b/customizer.php index 4b15a43..878f105 100644 --- a/customizer.php +++ b/customizer.php @@ -351,7 +351,7 @@ public function display_inputs( $font_locations, $wp_customize, $section = 'main $default = array( '' => 'Select a Font', - $font_location['default'] => $font_location['default'] . ' (default)', + $font_location['default'] => !empty( $font_location['default_title'] ) ? $font_location['default_title'] : sprintf( esc_html__( '%s (default)', 'typecase' ), $font_location['default'] ), ); $wp_customize->add_control( From 00d13ff3916357f53844f9fea70df4d7f70542a5 Mon Sep 17 00:00:00 2001 From: Nate Wright Date: Fri, 4 Mar 2016 10:37:46 +0000 Subject: [PATCH 3/3] Skip font styles if no selectors are defined --- typecase.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/typecase.php b/typecase.php index 85c20ec..3e1aaef 100644 --- a/typecase.php +++ b/typecase.php @@ -456,6 +456,11 @@ public function display_frontend(){ $import_url .= '|'; $import_url .= str_replace(" ","+",$family).$this->stringify_font_part($weights).$this->stringify_font_part($charsets); + + // Skip font styles if no selectors are defined + if ( empty( $selectors ) ) { + continue; + } $selectors = explode("|",$selectors);