add_panel( 'bigbang_header_options', array( 'priority' => 35, 'title' => esc_html__( 'Header Options', 'bigbang' ), ) ); /** * Header image section. */ // Move Header Image section to Header Options panel $header_image_section = $wp_customize->get_section( 'header_image' ); if ( ! empty( $header_image_section ) ) { $header_image_section->panel = 'bigbang_header_options'; $header_image_section->priority = 20; $header_image_section->title = esc_html__( 'Header Settings', 'bigbang' ); } /** * Move header image control lower in the section. */ $header_image_control = $wp_customize->get_control( 'header_image' ); if ( ! empty( $header_image_control ) ) { $header_image_control->priority = 15; } $header_image_data_control = $wp_customize->get_control( 'header_image_data' ); if ( ! empty( $header_image_data_control ) ) { $header_image_data_control->priority = 20; } // Use Header Image Site-wide. $wp_customize->add_setting( 'bigbang_header_image_sitewide', array( 'sanitize_callback' => 'bigbang_sanitize_checkbox', 'default' => false, ) ); $wp_customize->add_control( 'bigbang_header_image_sitewide', array( 'type' => 'checkbox', 'label' => esc_html__( 'Enable Header Image Sitewide', 'bigbang' ), 'section' => 'header_image', 'priority' => 25, ) ); /** * Top bar section. */ $wp_customize->add_section( 'bigbang_top_bar', array( 'title' => esc_html__( 'Very Top Bar', 'bigbang' ), 'panel' => 'bigbang_header_options', 'priority' => 10, ) ); $wp_customize->add_setting( 'bigbang_top_bar_hide', array( 'sanitize_callback' => 'bigbang_sanitize_checkbox', 'default' => true, ) ); $wp_customize->add_control( 'bigbang_top_bar_hide', array( 'type' => 'checkbox', 'label' => esc_html__( 'Disable section', 'bigbang' ), 'section' => 'bigbang_top_bar', 'priority' => 1, ) ); if ( class_exists( 'bigbang_Display_Text' ) ) { $wp_customize->add_setting( 'bigbang_link_to_top_menu', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( new bigbang_Display_Text( $wp_customize, 'bigbang_link_to_top_menu', array( 'priority' => 25, 'section' => 'bigbang_top_bar', 'button_text' => esc_html__( 'Very Top Bar', 'bigbang' ) . ' ' . esc_html__( 'Menu', 'bigbang' ), 'button_class' => 'bigbang-link-to-top-menu', 'icon_class' => 'fa-bars', ) ) ); } $selective_refresh = isset( $wp_customize->selective_refresh ) ? true : false; /* Control for menu selective refresh */ $wp_customize->add_setting( 'bigbang_top_menu_hidden', array( 'sanitize_callback' => 'sanitize_text_field', 'transport' => $selective_refresh, ) ); $wp_customize->add_control( 'bigbang_top_menu_hidden', array( 'priority' => 25, 'type' => 'hidden', 'section' => 'menu_locations', ) ); $top_bar_sidebar = $wp_customize->get_section( 'sidebar-widgets-sidebar-top-bar' ); if ( ! empty( $top_bar_sidebar ) ) { $top_bar_sidebar->panel = 'bigbang_header_options'; $controls_to_move = array( 'bigbang_top_bar_hide', 'bigbang_link_to_top_menu', ); foreach ( $controls_to_move as $control ) { $bigbang_control = $wp_customize->get_control( $control ); if ( ! empty( $bigbang_control ) ) { $bigbang_control->section = 'sidebar-widgets-sidebar-top-bar'; $bigbang_control->priority = -2; } } } /** * Navigation section. */ $wp_customize->add_section( 'bigbang_navigation', array( 'title' => esc_html__( 'Navigation', 'bigbang' ), 'panel' => 'bigbang_header_options', 'priority' => 15, ) ); /** * Search in menu. */ $wp_customize->add_setting( 'bigbang_search_in_menu', array( 'sanitize_callback' => 'bigbang_sanitize_checkbox', 'default' => false, ) ); $wp_customize->add_control( 'bigbang_search_in_menu', array( 'type' => 'checkbox', 'label' => esc_html__( 'Enable Search in Menu', 'bigbang' ), 'section' => 'bigbang_navigation', 'priority' => 5, ) ); if ( class_exists( 'bigbang_Customize_Control_Radio_Image' ) ) { $wp_customize->add_setting( 'bigbang_header_alignment', array( 'default' => 'left', 'sanitize_callback' => 'bigbang_sanitize_alignment_options', ) ); $wp_customize->add_control( new bigbang_Customize_Control_Radio_Image( $wp_customize, 'bigbang_header_alignment', array( 'label' => esc_html__( 'Layout', 'bigbang' ), 'priority' => 25, 'section' => 'bigbang_navigation', 'choices' => array( 'left' => array( 'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqAgMAAAAjP0ATAAAADFBMVEX////V1dUAhbo+yP8aB7nsAAAARklEQVRYhWNgGEGA/z8EHKC+MqZVq1ah4xGtjOLgHQWjYBSMgmENREOxgoDhp2xkASIDYxgoGwUUACJDdlTZKBgFo2DAAAAZAflVkm2NtwAAAABJRU5ErkJggg==', ), 'center' => array( 'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqAgMAAAAjP0ATAAAADFBMVEX////V1dUAhbo+yP8aB7nsAAAARElEQVRYR2NgGKngPwT8GVU2BJQNb6C1atUCfHjEKRsFo2BEANFQrCBg+CkbWYDIwBgGykYBBYDIkB1VNgpGwSgYMAAAzIYr4wYj4sEAAAAASUVORK5CYII=', ), 'right' => array( 'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqBAMAAACsf7WzAAAAD1BMVEX////V1dXF7v8Ahbo+yP+vNfjRAAAAWUlEQVR42u3TsQ2AMAxFQRAswAaIFViB/WeKlI4KgUJMwl3j7lXfA3+xXVvfas3HmZaWVtw/1mrRjmnPnl6tDlsAEcblFq2PtuhLyS1oxbWgjpIL1dICgEYlsKfbvyzuWeMAAAAASUVORK5CYII=', ), ), ) ) ); } $navigation_sidebar = $wp_customize->get_section( 'sidebar-widgets-header-sidebar' ); if ( ! empty( $navigation_sidebar ) ) { $navigation_sidebar->panel = 'bigbang_header_options'; $bigbang_header_alignment = $wp_customize->get_control( 'bigbang_header_alignment' ); if ( ! empty( $bigbang_header_alignment ) ) { $bigbang_header_alignment->section = 'sidebar-widgets-header-sidebar'; $bigbang_header_alignment->priority = -1; } $bigbang_search_in_menu = $wp_customize->get_control( 'bigbang_search_in_menu' ); if ( ! empty( $bigbang_search_in_menu ) ) { $bigbang_search_in_menu->section = 'sidebar-widgets-header-sidebar'; $bigbang_search_in_menu->priority = -1; } } /** * Customize control for header layout. */ if ( class_exists( 'bigbang_Customize_Control_Radio_Image' ) ) { $sidebar_choices = apply_filters( 'bigbang_header_layout_choices', array( 'default' => array( 'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqBAMAAACsf7WzAAAAD1BMVEU+yP/////Y9P/G7//V1dUbjhlcAAAAW0lEQVR4Ae3SAQmAYAyE0V9NMDCBCQxh/0wKGGCAIJ7vC3DA28ZvkjRVo49vzVujoeYFbF15i32pu4CtlCTVc+Vu2VqPRi9ssWfPnj179uzZs2fPnj179uwzt07LZ+4ImOW7JwAAAABJRU5ErkJggg==', ), 'no-content' => array( 'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABqBAMAAACsf7WzAAAAElBMVEU+yP////88SFhjbXl1fonV1dUUDrn8AAAAXElEQVR4Ae3SMQ2AYAyEUSwAYOC3gAJE4N8KCztNKEPT9wm44eUmSZL0b3NeXbeWEaj41noEet/yCVs+cW7jqfjW12ztV6D8Lfbs2bNnz549e/bs2bNnz559060bqAJ8azq5sAYAAAAASUVORK5CYII=', ), ) ); $wp_customize->add_setting( 'bigbang_header_layout', array( 'sanitize_callback' => 'sanitize_key', 'default' => 'default', ) ); $wp_customize->add_control( new bigbang_Customize_Control_Radio_Image( $wp_customize, 'bigbang_header_layout', array( 'label' => esc_html__( 'Layout', 'bigbang' ), 'section' => 'header_image', 'priority' => 10, 'choices' => $sidebar_choices, ) ) ); } } add_action( 'customize_register', 'bigbang_header_customize_register' ); /** * Add selective refresh for header section controls. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. * * @since 1.1.40 * @access public */ function bigbang_register_header_partials( $wp_customize ) { $wp_customize->selective_refresh->add_partial( 'bigbang_top_bar_alignment', array( 'selector' => '.bigbang-top-bar', 'settings' => 'bigbang_top_bar_alignment', 'render_callback' => 'bigbang_top_bar_callback', ) ); $wp_customize->selective_refresh->add_partial( 'bigbang_top_menu_hidden', array( 'selector' => '.top-bar-nav', 'settings' => 'bigbang_top_menu_hidden', 'render_callback' => 'bigbang_top_bar_callback', ) ); } add_action( 'customize_register', 'bigbang_register_header_partials' ); /** * Callback function for top bar alignment. * * @since 1.1.40 */ function bigbang_top_bar_callback() { bigbang_the_header_top_bar( true ); } /** * Get top bar style from customizer controls. * * @since 1.1.48 */ function bigbang_get_top_bar_style() { $custom_css = ''; $bigbang_top_bar_background = get_theme_mod( 'bigbang_top_bar_background_color', '#363537' ); if ( ! empty( $bigbang_top_bar_background ) ) { $custom_css .= '.bigbang-top-bar, .bigbang-top-bar .widget.widget_shopping_cart .cart_list { background-color: ' . $bigbang_top_bar_background . ' } .bigbang-top-bar .widget .label-floating input[type=search]:-webkit-autofill { -webkit-box-shadow: inset 0 0 0px 9999px ' . $bigbang_top_bar_background . ' }'; } $bigbang_top_bar_text_color = get_theme_mod( 'bigbang_top_bar_text_color', '#ffffff' ); if ( ! empty( $bigbang_top_bar_background ) ) { $custom_css .= '.bigbang-top-bar, .bigbang-top-bar .widget .label-floating input[type=search], .bigbang-top-bar .widget.widget_search form.form-group:before, .bigbang-top-bar .widget.widget_product_search form.form-group:before, .bigbang-top-bar .widget.widget_shopping_cart:before { color: ' . $bigbang_top_bar_text_color . ' } .bigbang-top-bar .widget .label-floating input[type=search]{ -webkit-text-fill-color:' . $bigbang_top_bar_text_color . ' !important }'; } $bigbang_top_bar_link_color = get_theme_mod( 'bigbang_top_bar_link_color', '#ffffff' ); if ( ! empty( $bigbang_top_bar_link_color ) ) { $custom_css .= '.bigbang-top-bar a, .bigbang-top-bar .top-bar-nav li a { color: ' . $bigbang_top_bar_link_color . ' }'; } $bigbang_top_bar_link_color_hover = get_theme_mod( 'bigbang_top_bar_link_color_hover', '#eeeeee' ); if ( ! empty( $bigbang_top_bar_link_color_hover ) ) { $custom_css .= '.bigbang-top-bar a:hover, .bigbang-top-bar .top-bar-nav li a:hover { color: ' . $bigbang_top_bar_link_color_hover . ' }'; } return $custom_css; } /** * Adds advanced inline style from customizer. * * @since 1.1.40 */ function bigbang_top_bar_inline_style() { $custom_css = bigbang_get_top_bar_style(); wp_add_inline_style( 'bigbang_style', $custom_css ); } add_action( 'wp_enqueue_scripts', 'bigbang_top_bar_inline_style' );