From 2bf1badc0dda70df0cd419446d04ff07f2b82b23 Mon Sep 17 00:00:00 2001 From: claudiuvertistudio Date: Wed, 8 Jun 2016 13:49:45 +0300 Subject: [PATCH] #46 Removal of Core Options --- functions.php | 37 +++++++++++--------------------- inc/custom-header.php | 2 ++ inc/customizer.php | 20 +++++++++++------ js/customizer.js | 50 +++++++++++++++++++++++++++---------------- style.css | 4 ++++ 5 files changed, 65 insertions(+), 48 deletions(-) diff --git a/functions.php b/functions.php index 1cf779d..3db000c 100644 --- a/functions.php +++ b/functions.php @@ -306,39 +306,28 @@ function zillah_brand(){ echo '
'; - if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) { - the_custom_logo(); - echo '
'; - if ( is_front_page() && is_home() ) : ?> -

- -

- '; + $zillah_tagline_hide = get_theme_mod( 'zillah_tagline_show', false ); - } else { - if( is_customize_preview() ){ ?> - - - - '; + + if( ( ! $zillah_tagline_hide && display_header_text() ) || is_customize_preview() ) { + echo '
'; if ( is_front_page() && is_home() ) : ?>

'; - } + echo '
'; + } - $description = get_bloginfo( 'description', 'display' ); - if ( $description || is_customize_preview() ) : ?> -

- +

+ '; } diff --git a/inc/custom-header.php b/inc/custom-header.php index 389ea5b..df61686 100644 --- a/inc/custom-header.php +++ b/inc/custom-header.php @@ -31,3 +31,5 @@ function zillah_custom_header_setup() { } add_action( 'after_setup_theme', 'zillah_custom_header_setup' ); + + diff --git a/inc/customizer.php b/inc/customizer.php index 3bffd0a..aa1ccc6 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -14,24 +14,32 @@ function zillah_customize_register( $wp_customize ) { $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; - $wp_customize->get_setting( 'header_textcolor' )->default = '#7fcaad'; require_once ( 'class/zillah_category-selector-control.php'); - - $wp_customize->remove_control( 'display_header_text' ); $wp_customize->get_control( 'blogname' )->priority = 3; $wp_customize->get_control( 'blogdescription' )->priority = 4; - $wp_customize->remove_control( 'background_color' ); - $wp_customize->remove_control( 'header_textcolor' ); - $custom_logo = $wp_customize->get_control( 'custom_logo' ); if( !empty( $custom_logo ) ) { $wp_customize->get_control( 'custom_logo' )->priority = 5; } + /* Title tagline */ + $wp_customize->add_setting('zillah_tagline_show', array( + 'default' => 0, + 'sanitize_callback' => 'zillah_sanitize_checkbox', + 'transport' => 'postMessage', + )); + + $wp_customize->add_control('zillah_tagline_show', array( + 'label' => esc_html__('Hide Site Title', 'zillah'), + 'section' => 'title_tagline', + 'priority' => 50, + 'type' => 'checkbox', + )); + /* Advanced options */ $wp_customize->add_section( 'zillah_home_theme_option_section', array( 'title' => esc_html__( 'Theme options', 'zillah' ), diff --git a/js/customizer.js b/js/customizer.js index 7a79aba..ef15321 100644 --- a/js/customizer.js +++ b/js/customizer.js @@ -14,6 +14,7 @@ $( '.site-title a' ).text( to ); } ); } ); + wp.customize( 'blogdescription', function( value ) { value.bind( function( to ) { $( '.site-description' ).text( to ); @@ -21,24 +22,37 @@ } ); // Header text color. - wp.customize( 'header_textcolor', function( value ) { - value.bind( function( to ) { - if ( 'blank' === to ) { - $( '.site-title a, .site-description' ).css( { - 'clip': 'rect(1px, 1px, 1px, 1px)', - 'position': 'absolute' - } ); - } else { - $( '.site-title a' ).css( { - 'clip': 'auto', - 'position': 'relative' - } ); - $( '.site-title a' ).css( { - 'color': to - } ); - } - } ); - } ); + wp.customize( 'header_textcolor', function( value ) { + value.bind( function( to ) { + if ( 'blank' === to ) { + $( '.site-title a, .site-description' ).css( { + 'clip': 'rect(1px, 1px, 1px, 1px)', + 'position': 'absolute' + } ); + } else { + $( '.site-title a, .site-description' ).css( { + 'clip': 'auto', + 'position': 'relative' + } ); + $( '.site-title a' ).css( { + 'color': to + } ); + } + } ); + } ); + + // Hide Site Title + wp.customize( 'zillah_tagline_show', function( value ) { + value.bind( function( to ) { + if( to != '' ) { + $( '.header-title-wrap' ).addClass( 'zillah-only-customizer' ); + } + else { + $( '.header-title-wrap' ).removeClass( 'zillah-only-customizer' ); + } + } ); + } ); + // Logo wp.customize( 'custom_logo', function( value ) { diff --git a/style.css b/style.css index 3887a41..978afdc 100644 --- a/style.css +++ b/style.css @@ -1721,6 +1721,10 @@ object { padding: 12px 0; } +.header-title-wrap { + margin-top: 20px; +} + .menu-toggle-button-wrap { display: table-cell; vertical-align: middle;