__( 'Top Bar', 'bongoto-woocommerce' ), 'priority' => 25, 'description' => __( 'Controls the thin top bar shown above Header variants 2–5. (Pro + requires Topbar CSS from Demo Import)', 'bongoto-woocommerce' ), ); // Only attach panel if it exists (prevents Customizer errors). if ( $wp_customize->get_panel( $panel_id ) ) { $section_args['panel'] = $panel_id; } $wp_customize->add_section( 'bongoto_topbar_section', $section_args ); // Enable $wp_customize->add_setting( 'bongoto_woocommerce_topbar_enable', array( 'default' => true, 'sanitize_callback' => function( $v ) use ( $can_use ) { $v = bongoto_woocommerce_sanitize_checkbox( $v ); return $can_use ? $v : false; }, 'transport' => 'refresh', ) ); $wp_customize->add_control( 'bongoto_woocommerce_topbar_enable', array( 'type' => 'checkbox', 'section' => 'bongoto_topbar_section', 'label' => __( 'Enable Top Bar', 'bongoto-woocommerce' ), 'description' => ( ! $is_pro ) ? __( 'Top Bar is a Pro feature. Verify your purchase code to unlock it.', 'bongoto-woocommerce' ) : ( $has_css ? __( 'Show the top bar above the header.', 'bongoto-woocommerce' ) : __( 'Run Demo Import once to download Topbar CSS, then this option will unlock.', 'bongoto-woocommerce' ) ), 'active_callback' => function() { return true; }, ) ); $controls_active = function() use ( $can_use ) { return $can_use && (bool) get_theme_mod( 'bongoto_woocommerce_topbar_enable', true ); }; // Phone $wp_customize->add_setting( 'bongoto_woocommerce_topbar_phone', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'refresh', ) ); $wp_customize->add_control( 'bongoto_woocommerce_topbar_phone', array( 'type' => 'text', 'section' => 'bongoto_topbar_section', 'label' => __( 'Phone', 'bongoto-woocommerce' ), 'input_attrs' => array( 'placeholder' => '+880 1XXXXXXXXX' ), 'active_callback' => $controls_active, ) ); // Email $wp_customize->add_setting( 'bongoto_woocommerce_topbar_email', array( 'default' => '', 'sanitize_callback' => 'sanitize_email', 'transport' => 'refresh', ) ); $wp_customize->add_control( 'bongoto_woocommerce_topbar_email', array( 'type' => 'text', 'section' => 'bongoto_topbar_section', 'label' => __( 'Email', 'bongoto-woocommerce' ), 'input_attrs' => array( 'placeholder' => 'info@example.com' ), 'active_callback' => $controls_active, ) ); // Show login/register $wp_customize->add_setting( 'bongoto_woocommerce_topbar_show_login', array( 'default' => true, 'sanitize_callback' => function( $v ) use ( $can_use ) { $v = bongoto_woocommerce_sanitize_checkbox( $v ); return $can_use ? $v : false; }, 'transport' => 'refresh', ) ); $wp_customize->add_control( 'bongoto_woocommerce_topbar_show_login', array( 'type' => 'checkbox', 'section' => 'bongoto_topbar_section', 'label' => __( 'Show Login / Register', 'bongoto-woocommerce' ), 'active_callback' => $controls_active, ) ); // Social links $social_fields = array( 'facebook' => __( 'Facebook URL', 'bongoto-woocommerce' ), 'instagram' => __( 'Instagram URL', 'bongoto-woocommerce' ), 'linkedin' => __( 'LinkedIn URL', 'bongoto-woocommerce' ), 'twitter' => __( 'Twitter/X URL', 'bongoto-woocommerce' ), 'pinterest' => __( 'Pinterest URL', 'bongoto-woocommerce' ), ); foreach ( $social_fields as $key => $label ) { $setting = 'bongoto_woocommerce_topbar_social_' . $key; $wp_customize->add_setting( $setting, array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', 'transport' => 'refresh', ) ); $wp_customize->add_control( $setting, array( 'type' => 'url', 'section' => 'bongoto_topbar_section', 'label' => $label, 'active_callback' => $controls_active, ) ); } /** * NOTE: * Topbar colors are controlled via presets (CSS variables), * not via Customizer color pickers. */ } );