remove_section( 'colors'); $wp_customize->remove_section( 'background_image'); /*-----------------------------------------------------------------------------------*/ /* Site Title & Tagline /*-----------------------------------------------------------------------------------*/ $wp_customize->add_section( 'title_tagline', array( 'title' => 'Site Identity', 'description' => '', 'priority' => 1, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /* Turn ON/OFF Logo Image */ $wp_customize->add_setting( 'brubeck_image_logo_enable', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'brubeck_sanitize_text' ) ); $wp_customize->add_control( 'brubeck_image_logo_enable', array( 'label' => 'Turn ON/OFF Image Logo', 'section' => 'title_tagline', 'settings' => 'brubeck_image_logo_enable', 'type' => 'checkbox' ) ); /* Logo Image Upload */ $wp_customize->add_setting( 'brubeck_image_logo_upload', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'brubeck_image_logo_upload', array( 'label' => 'Upload Logo', 'description' => 'Upload your logo and it must be a retina logo.', 'section' => 'title_tagline', 'settings' => 'brubeck_image_logo_upload' ) ) ); /* Logo Image Height */ $wp_customize->add_setting( 'brubeck_image_logo_height', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'brubeck_image_logo_height', array( 'label' => 'Logo Height Size', 'description' => 'Enter your logo height to reorder elements of the header. Min height: 50px. Max height: 80px.', 'section' => 'title_tagline', 'settings' => 'brubeck_image_logo_height', 'type' => 'range', 'input_attrs' => array( 'min' => 50, 'max' => 80, 'step' => 1 ), ) ); /* Logo for Mobile Image Upload */ $wp_customize->add_setting( 'brubeck_image_logo_mobile_upload', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'brubeck_image_logo_mobile_upload', array( 'label' => 'Upload Logo for Mobile', 'description' => 'This is a feature to make sure your site has a beautiful logo on mobile. Must be a retina logo. Max height: 40px.', 'section' => 'title_tagline', 'settings' => 'brubeck_image_logo_mobile_upload' ) ) ); /* Logo for SEO */ $wp_customize->add_setting( 'brubeck_image_logo_seo_upload', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'brubeck_image_logo_seo_upload', array( 'label' => 'Upload Logo for Schema.org (200x200)', 'description' => 'This logo will be used for Schema.org. The size is used to be 200x200.', 'section' => 'title_tagline', 'settings' => 'brubeck_image_logo_seo_upload' ) ) ); /* Facebook Link */ $wp_customize->add_setting( 'brubeck_facebook_link', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'brubeck_facebook_link', array( 'label' => 'Facebook Link', 'section' => 'title_tagline', 'settings' => 'brubeck_facebook_link', 'type' => 'text' ) ); /* Twitter Account */ $wp_customize->add_setting( 'brubeck_twitter_account', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'brubeck_twitter_account', array( 'label' => 'Twitter Account', 'section' => 'title_tagline', 'settings' => 'brubeck_twitter_account', 'type' => 'text' ) ); /* Google Plus Link */ $wp_customize->add_setting( 'brubeck_google_plus_link', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'brubeck_google_plus_link', array( 'label' => 'Google Plus Link', 'section' => 'title_tagline', 'settings' => 'brubeck_google_plus_link', 'type' => 'text' ) ); /* Linkedin Link */ $wp_customize->add_setting( 'brubeck_linkedin_link', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'brubeck_linkedin_link', array( 'label' => 'Linkedin Link', 'section' => 'title_tagline', 'settings' => 'brubeck_linkedin_link', 'type' => 'text' ) ); /* Instagram Link */ $wp_customize->add_setting( 'brubeck_instagram_link', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'brubeck_instagram_link', array( 'label' => 'Instagram Link', 'section' => 'title_tagline', 'settings' => 'brubeck_instagram_link', 'type' => 'text' ) ); /* Pinterest Link */ $wp_customize->add_setting( 'brubeck_pinterest_link', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'brubeck_pinterest_link', array( 'label' => 'Pinterest Link', 'section' => 'title_tagline', 'settings' => 'brubeck_pinterest_link', 'type' => 'text' ) ); /* Youtube Link */ $wp_customize->add_setting( 'brubeck_youtube_link', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'brubeck_youtube_link', array( 'label' => 'Youtube Link', 'section' => 'title_tagline', 'settings' => 'brubeck_youtube_link', 'type' => 'text' ) ); /* RSS Feed Link */ $wp_customize->add_setting( 'brubeck_rss_link', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'brubeck_rss_link', array( 'label' => 'RSS Feed Link', 'section' => 'title_tagline', 'settings' => 'brubeck_rss_link', 'type' => 'text' ) ); /* Copyright */ $wp_customize->add_setting( 'brubeck_copyright', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'brubeck_sanitize_textarea' ) ); $wp_customize->add_control( 'brubeck_copyright', array( 'label' => 'Copyright', 'section' => 'title_tagline', 'settings' => 'brubeck_copyright', 'type' => 'textarea' ) ); /*-----------------------------------------------------------------------------------*/ /* Typography /*-----------------------------------------------------------------------------------*/ $wp_customize->add_panel( 'brubeck_typography', array( 'title' => 'Typography', 'description' => '', 'priority' => 2, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /* Typography --------------------------------------------- */ $wp_customize->add_section('brubeck_typography', array( 'title' => 'Typoraphy', 'priority' => 1 ) ); /* Remove Default Fonts. */ $wp_customize->add_setting( 'brubeck_default_fonts_remove', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'brubeck_sanitize_text', ) ); $wp_customize->add_control( 'brubeck_default_fonts_remove', array( 'label' => 'Remove Default Fonts', 'section' => 'brubeck_typography', 'settings' => 'brubeck_default_fonts_remove', 'type' => 'checkbox', ) ); /* Use Custom Fonts. */ $wp_customize->add_setting( 'brubeck_custom_fonts_enable', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'brubeck_sanitize_text', ) ); $wp_customize->add_control( 'brubeck_custom_fonts_enable', array( 'label' => 'Use Custom Fonts', 'section' => 'brubeck_typography', 'settings' => 'brubeck_custom_fonts_enable', 'type' => 'checkbox', ) ); /* Fonts Link or JS code. */ $wp_customize->add_setting( 'brubeck_fonts_code', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'brubeck_sanitize_textarea', ) ); $wp_customize->add_control( 'brubeck_fonts_code', array( 'label' => 'Fonts Code. Ex: https://goo.gl/mT2ovg', 'section' => 'brubeck_typography', 'settings' => 'brubeck_fonts_code', 'type' => 'textarea', ) ); /* Primary: font-family CSS Code. */ $wp_customize->add_setting( 'brubeck_primary_font_family', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'brubeck_sanitize_textarea', ) ); $wp_customize->add_control( 'brubeck_primary_font_family', array( 'label' => 'Primary: font-family CSS Code', 'section' => 'brubeck_typography', 'settings' => 'brubeck_primary_font_family', 'type' => 'textarea', ) ); /*-----------------------------------------------------------------------------------*/ /* Colors /*-----------------------------------------------------------------------------------*/ $wp_customize->add_panel( 'brubeck_colors', array( 'title' => 'Colors', 'description' => '', 'priority' => 3, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /* Colors --------------------------------------------- */ $wp_customize->add_section('brubeck_colors', array( 'title' => 'Colors', 'priority' => 1 ) ); /* Background Color */ $wp_customize->add_setting( 'brubeck_background_color', array( 'default' => '#f2f2f2', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'brubeck_background_color', array( 'label' => 'Background Color', 'section' => 'brubeck_colors', 'settings' => 'brubeck_background_color' ) ) ); /* Brand Color */ $wp_customize->add_setting( 'brubeck_brand_color', array( 'default' => '#3897f0', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'brubeck_brand_color', array( 'label' => 'Brand Color', 'section' => 'brubeck_colors', 'settings' => 'brubeck_brand_color' ) ) ); /* Brand Text Color */ $wp_customize->add_setting( 'brubeck_brand_text_color', array( 'default' => '#ffffff', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'brubeck_brand_text_color', array( 'label' => 'Brand Text Color', 'section' => 'brubeck_colors', 'settings' => 'brubeck_brand_text_color' ) ) ); /* Link Color */ $wp_customize->add_setting( 'brubeck_link_color', array( 'default' => '#3897f0', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'brubeck_link_color', array( 'label' => 'Link Color', 'section' => 'brubeck_colors', 'settings' => 'brubeck_link_color' ) ) ); /*-----------------------------------------------------------------------------------*/ /* Homepage Newsletter /*-----------------------------------------------------------------------------------*/ $wp_customize->add_panel( 'brubeck_homepage_newsletter', array( 'title' => 'Homepage Newsletter', 'description' => '', 'priority' => 4, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /* Homepage newsletter. --------------------------------------------- */ $wp_customize->add_section('brubeck_homepage_newsletter', array( 'title' => 'Homepage Newsletter', 'priority' => 1 ) ); /* Homepage Newsletter - Enable */ $wp_customize->add_setting( 'brubeck_homepage_newsletter_enable', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'brubeck_sanitize_text', ) ); $wp_customize->add_control( 'brubeck_homepage_newsletter_enable', array( 'label' => 'Enable', 'section' => 'brubeck_homepage_newsletter', 'settings' => 'brubeck_homepage_newsletter_enable', 'type' => 'checkbox' ) ); /* Homepage Newsletter - Background */ $wp_customize->add_setting( 'brubeck_homepage_newsletter_background', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'brubeck_homepage_newsletter_background', array( 'label' => 'Upload Background', 'description' => 'Upload a background image for the homepage newsletter.', 'section' => 'brubeck_homepage_newsletter', 'settings' => 'brubeck_homepage_newsletter_background' ) ) ); /* Homepage Newsletter - Title */ $wp_customize->add_setting( 'brubeck_homepage_newsletter_title', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_textarea_field' ) ); $wp_customize->add_control( 'brubeck_homepage_newsletter_title', array( 'label' => 'Title', 'section' => 'brubeck_homepage_newsletter', 'settings' => 'brubeck_homepage_newsletter_title', 'type' => 'textarea' ) ); /* Homepage Newsletter - Text */ $wp_customize->add_setting( 'brubeck_homepage_newsletter_text', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_textarea_field' ) ); $wp_customize->add_control( 'brubeck_homepage_newsletter_text', array( 'label' => 'Text', 'section' => 'brubeck_homepage_newsletter', 'settings' => 'brubeck_homepage_newsletter_text', 'type' => 'textarea' ) ); /* Homepage Newsletter - Code */ $wp_customize->add_setting( 'brubeck_homepage_newsletter_code', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'brubeck_sanitize_textarea' ) ); $wp_customize->add_control( 'brubeck_homepage_newsletter_code', array( 'label' => 'Newsletter Code. Ex: goo.gl/Jd7AUd', 'section' => 'brubeck_homepage_newsletter', 'settings' => 'brubeck_homepage_newsletter_code', 'type' => 'textarea' ) ); /*-----------------------------------------------------------------------------------*/ /* Single Post /*-----------------------------------------------------------------------------------*/ $wp_customize->add_panel( 'brubeck_single_post', array( 'title' => 'Single Post', 'description' => '', 'priority' => 5, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /* Single Post. --------------------------------------------- */ $wp_customize->add_section('brubeck_single_post', array( 'title' => 'Single Post', 'priority' => 1 ) ); /* Remove The Entry Share */ $wp_customize->add_setting( 'brubeck_entry_share_remove', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'brubeck_sanitize_text', ) ); $wp_customize->add_control( 'brubeck_entry_share_remove', array( 'label' => 'Remove The Entry Share.', 'section' => 'brubeck_single_post', 'settings' => 'brubeck_entry_share_remove', 'type' => 'checkbox' ) ); /* Remove The Author Box */ $wp_customize->add_setting( 'brubeck_author_box_remove', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'brubeck_sanitize_text', ) ); $wp_customize->add_control( 'brubeck_author_box_remove', array( 'label' => 'Remove The Author Box.', 'section' => 'brubeck_single_post', 'settings' => 'brubeck_author_box_remove', 'type' => 'checkbox' ) ); /* Remove Related Posts */ $wp_customize->add_setting( 'brubeck_related_posts_remove', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'brubeck_sanitize_text', ) ); $wp_customize->add_control( 'brubeck_related_posts_remove', array( 'label' => 'Remove Related Posts.', 'section' => 'brubeck_single_post', 'settings' => 'brubeck_related_posts_remove', 'type' => 'checkbox' ) ); /* Remove Recent Posts */ $wp_customize->add_setting( 'brubeck_recent_posts_remove', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'brubeck_sanitize_text', ) ); $wp_customize->add_control( 'brubeck_recent_posts_remove', array( 'label' => 'Remove Recent Posts.', 'section' => 'brubeck_single_post', 'settings' => 'brubeck_recent_posts_remove', 'type' => 'checkbox' ) ); /*-----------------------------------------------------------------------------------*/ /* Google Analytics /*-----------------------------------------------------------------------------------*/ $wp_customize->add_panel( 'brubeck_google_analytics', array( 'title' => 'Google Analytics', 'description' => '', 'priority' => 6, 'capability' => 'edit_theme_options', 'theme_supports' => '' ) ); /* Google Analytics --------------------------------------------- */ $wp_customize->add_section('brubeck_google_analytics', array( 'title' => 'Google Analytics', 'priority' => 1 ) ); /* Google Analytics. */ $wp_customize->add_setting( 'brubeck_google_analytics', array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'brubeck_sanitize_textarea', ) ); $wp_customize->add_control( 'brubeck_google_analytics', array( 'label' => 'Google Analytics', 'section' => 'brubeck_google_analytics', 'settings' => 'brubeck_google_analytics', 'type' => 'textarea' ) ); } add_action('customize_register', 'brubeck_customizer'); /** * Sanitize. */ // Text, color, checkbox, select. function brubeck_sanitize_text( $str ) { return sanitize_text_field( $str ); } // Textarea. function brubeck_sanitize_textarea( $textarea ) { return $textarea; } /** * Customize preview. */ function brubeck_customize_preview_js() { wp_enqueue_script( 'brubeck-customize-preview', get_template_directory_uri() . '/inc/customizer/customize-preview.js', array( 'customize-preview' ), '100', true ); } add_action( 'customize_preview_init', 'brubeck_customize_preview_js' );