add_section( 'bongoto_section_hero', array( 'title' => __( 'Home Hero', 'bongoto-woocommerce' ), 'description' => __( 'Front-page Hero content (automatically hidden if the page is built with Elementor).', 'bongoto-woocommerce' ), 'priority' => 30, ) ); // Title (plain text). $wp_customize->add_setting( 'bongoto_hero_title', array( 'default' => __( 'A Modern WooCommerce Storefront', 'bongoto-woocommerce' ), 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'bongoto_hero_title', array( 'label' => __( 'Hero Title', 'bongoto-woocommerce' ), 'section' => 'bongoto_section_hero', 'type' => 'text', ) ); // Subtitle (allow basic formatting). $wp_customize->add_setting( 'bongoto_hero_subtitle', array( 'default' => __( 'Showcase and sell your products with a fast, clean WooCommerce-ready layout.', 'bongoto-woocommerce' ), 'sanitize_callback' => 'wp_kses_post', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'bongoto_hero_subtitle', array( 'label' => __( 'Hero Subtitle', 'bongoto-woocommerce' ), 'section' => 'bongoto_section_hero', 'type' => 'textarea', ) ); // Button text. $wp_customize->add_setting( 'bongoto_hero_button_text', array( 'default' => __( 'Shop Now', 'bongoto-woocommerce' ), 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'bongoto_hero_button_text', array( 'label' => __( 'Button Text', 'bongoto-woocommerce' ), 'section' => 'bongoto_section_hero', 'type' => 'text', ) ); // Button URL. $wp_customize->add_setting( 'bongoto_hero_button_url', array( // Default points to a typical WooCommerce shop URL; site owners can change it. 'default' => home_url( '/shop/' ), 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'bongoto_hero_button_url', array( 'label' => __( 'Button URL', 'bongoto-woocommerce' ), 'section' => 'bongoto_section_hero', 'type' => 'url', ) ); // Background image. $wp_customize->add_setting( 'bongoto_hero_bg', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'bongoto_hero_bg', array( 'label' => __( 'Background Image', 'bongoto-woocommerce' ), 'section' => 'bongoto_section_hero', 'settings' => 'bongoto_hero_bg', ) ) ); // Selective refresh (live preview). if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'bongoto_hero_title', array( 'selector' => '.bt-hero__title', 'render_callback' => function () { return esc_html( get_theme_mod( 'bongoto_hero_title' ) ); }, ) ); $wp_customize->selective_refresh->add_partial( 'bongoto_hero_subtitle', array( 'selector' => '.bt-hero__subtitle', 'render_callback' => function () { // Allow minimal HTML previously sanitized by wp_kses_post. return wp_kses_post( get_theme_mod( 'bongoto_hero_subtitle' ) ); }, ) ); } } add_action( 'customize_register', 'bongoto_customize_register_hero' );