6 entries in
=> array( '' => esc_html__( 'Left', 'tripp' ), 'center' => esc_html__( 'Center', 'tripp' ), 'right' => esc_html__( 'Right', 'tripp' ), ), 'active_callback' => 'tripp_customizer_is_top_menu', ) ); // Navigation -> Background. $wp_customize->add_setting( 'nav_bg', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_select', ) ); $wp_customize->add_control( 'nav_bg', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Background', 'tripp' ), 'description' => esc_html__( 'The header background type.', 'tripp' ), 'type' => 'select', 'choices' => array( '' => esc_html__( 'Default', 'tripp' ), 'color' => esc_html__( 'Color', 'tripp' ), 'image' => esc_html__( 'Image', 'tripp' ), ), 'active_callback' => 'tripp_customizer_is_full_menu', ) ); $wp_customize->selective_refresh->add_partial( 'nav_bg', array( 'selector' => '#site-header .navigation-background', 'render_callback' => 'tripp_customizer_get_nav_background', 'container_inclusive' => true, ) ); // Navigation -> Background Color. $wp_customize->add_setting( 'nav_bg_color', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'nav_bg_color', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Background Color', 'tripp' ), 'description' => esc_html__( 'The default background color for the main header.', 'tripp' ), 'active_callback' => 'tripp_customizer_is_nav_bg_color_enabled', ) ) ); // Navigation -> Background Image. $wp_customize->add_setting( 'nav_bg_image', array( 'default' => 0, 'transport' => 'postMessage', 'sanitize_callback' => 'absint', ) ); $wp_customize->add_control( new WP_Customize_Cropped_Image_Control( $wp_customize, 'nav_bg_image', array( 'label' => esc_html__( 'Background Image', 'tripp' ), 'description' => esc_html__( 'A background image for the navigation menu.', 'tripp' ), 'section' => 'navigation_section', 'height' => 1080, 'width' => 1920, 'flex_height' => true, 'flex_width' => true, 'active_callback' => 'tripp_customizer_is_nav_bg_image_enabled', ) ) ); // Navigation -> Image Position. $wp_customize->add_setting( 'nav_bg_position', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_select', ) ); $wp_customize->add_control( 'nav_bg_position', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Image Position', 'tripp' ), 'description' => esc_html__( 'The header background image position.', 'tripp' ), 'type' => 'select', 'choices' => array( 'left top' => esc_html__( 'Left Top', 'tripp' ), 'left center' => esc_html__( 'Left Center', 'tripp' ), 'left bottom' => esc_html__( 'Left Bottom', 'tripp' ), 'right top' => esc_html__( 'Right Top', 'tripp' ), 'right center' => esc_html__( 'Right Center', 'tripp' ), 'right bottom' => esc_html__( 'Right Bottom', 'tripp' ), 'center top' => esc_html__( 'Center Top', 'tripp' ), '' => esc_html__( 'Center Center', 'tripp' ), 'center bottom' => esc_html__( 'Center Bottom', 'tripp' ), ), 'active_callback' => 'tripp_customizer_is_nav_bg_image_enabled', ) ); // Navigation -> Image Size. $wp_customize->add_setting( 'nav_bg_size', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_select', ) ); $wp_customize->add_control( 'nav_bg_size', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Image Size', 'tripp' ), 'description' => esc_html__( 'The header background image size.', 'tripp' ), 'type' => 'select', 'choices' => array( 'auto' => esc_html__( 'Original', 'tripp' ), 'contain' => esc_html__( 'Fit to Screen', 'tripp' ), '' => esc_html__( 'Fill Screen', 'tripp' ), ), 'active_callback' => 'tripp_customizer_is_nav_bg_image_enabled', ) ); // Navigation -> Repeated background. $wp_customize->add_setting( 'nav_bg_repeat', array( 'default' => false, 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_checkbox', ) ); $wp_customize->add_control( 'nav_bg_repeat', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Repeated background.', 'tripp' ), 'type' => 'checkbox', 'active_callback' => 'tripp_customizer_is_nav_bg_image_enabled', ) ); // Navigation -> Overlay Color. $wp_customize->add_setting( 'nav_bg_overlay_color', array( 'default' => '#000', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'nav_bg_overlay_color', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Overlay Color', 'tripp' ), 'description' => esc_html__( 'The color overlay for the header background image.', 'tripp' ), 'active_callback' => 'tripp_customizer_is_nav_bg_image_enabled', ) ) ); // Navigation -> Background Overlay Opacity. $wp_customize->add_setting( 'nav_bg_overlay_opacity', array( 'default' => 75, 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_number', ) ); $wp_customize->add_control( new Tripp_Customize_Range_Control( $wp_customize, 'nav_bg_overlay_opacity', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Overlay Opacity', 'tripp' ), 'description' => esc_html__( 'The header background overlay opacity.', 'tripp' ), 'input_attrs' => array( 'min' => 0, 'max' => 100, ), 'marks' => array( 0 => 0, 25 => 25, 50 => 50, 75 => 75, 100 => 100, ), 'active_callback' => 'tripp_customizer_is_nav_bg_image_enabled', ) ) ); // Navigation -> Navigation Bar Separator. $wp_customize->add_control( new Tripp_Customize_Separator_Control( $wp_customize, 'nav_bar_separator', array( 'section' => 'navigation_section', ) ) ); // Navigation -> Navigation Bar Options. $wp_customize->add_control( new Tripp_Customize_Label_Control( $wp_customize, 'nav_bar_options', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Navigation Bar Options', 'tripp' ), ) ) ); // Navigation -> Sticky Menu. $wp_customize->add_setting( 'nav_sticky_menu', array( 'default' => true, 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_checkbox', ) ); $wp_customize->add_control( 'nav_sticky_menu', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Sticky Menu', 'tripp' ), 'description' => esc_html__( 'Displays sticky menu when scrolling.', 'tripp' ), 'type' => 'checkbox', ) ); // Navigation -> Full Width Menu. $wp_customize->add_setting( 'nav_fullwidth_menu', array( 'default' => false, 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_checkbox', ) ); $wp_customize->add_control( 'nav_fullwidth_menu', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Full Width Menu', 'tripp' ), 'description' => esc_html__( 'Stretches the header menu container to full width.', 'tripp' ), 'type' => 'checkbox', ) ); // Navigation -> Extra Menu Buttons. $wp_customize->add_control( new Tripp_Customize_Label_Control( $wp_customize, 'nav_menu_buttons', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Menu Buttons', 'tripp' ), ) ) ); // Navigation -> Search Button. $wp_customize->add_setting( 'nav_search_button', array( 'default' => true, 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_checkbox', ) ); $wp_customize->add_control( 'nav_search_button', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Search Button', 'tripp' ), 'description' => esc_html__( 'Displays a search button.', 'tripp' ), 'type' => 'checkbox', ) ); // Navigation -> Displays a search button on mobile navigation menu by default. $wp_customize->add_setting( 'nav_search_button_mobile', array( 'default' => true, 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_checkbox', ) ); $wp_customize->add_control( 'nav_search_button_mobile', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Displays a search button on mobile navigation menu by default.', 'tripp' ), 'type' => 'checkbox', 'active_callback' => 'tripp_customizer_is_search_button_enabled', ) ); // Navigation -> Login Button. $wp_customize->add_setting( 'nav_login_button', array( 'default' => false, 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_checkbox', ) ); $wp_customize->add_control( 'nav_login_button', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Log In Button', 'tripp' ), 'description' => esc_html__( 'Displays a Log In button.', 'tripp' ), 'type' => 'checkbox', ) ); // Navigation -> Off-Canvas Sidebar Button. $wp_customize->add_setting( 'nav_sidebar_button', array( 'default' => true, 'transport' => 'postMessage', 'sanitize_callback' => 'tripp_customize_sanitize_checkbox', ) ); $wp_customize->add_control( 'nav_sidebar_button', array( 'section' => 'navigation_section', 'label' => esc_html__( 'Off-Canvas Sidebar Button', 'tripp' ), 'description' => esc_html__( 'Displays a toggle button to show or hide a slide-out sidebar.', 'tripp' ), 'type' => 'checkbox', ) ); /** * To improve user experience: * * - Move the Menus panel before the Header section. */ $wp_customize->get_panel( 'nav_menus' )->priority = 50; } add_action( 'customize_register', 'tripp_customizer_register_navigation_settings', 20 );