add_section( 'bongoto_section_hero', array( 'title' => __( 'Home Hero', 'bongoto' ), 'description' => __( 'Front-page Hero content (hidden automatically if the page is built with Elementor).', 'bongoto' ), 'priority' => 30, ) ); // Title $wp_customize->add_setting( 'bongoto_hero_title', array( 'default' => __( 'A Modern Digital Marketplace', 'bongoto' ), 'sanitize_callback' => 'wp_kses_post', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'bongoto_hero_title', array( 'label' => __( 'Hero Title', 'bongoto' ), 'section' => 'bongoto_section_hero', 'type' => 'text', ) ); // Subtitle $wp_customize->add_setting( 'bongoto_hero_subtitle', array( 'default' => __( 'Buy & sell digital products—themes, templates, plugins, graphics and more.', 'bongoto' ), 'sanitize_callback' => 'wp_kses_post', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'bongoto_hero_subtitle', array( 'label' => __( 'Hero Subtitle', 'bongoto' ), 'section' => 'bongoto_section_hero', 'type' => 'textarea', ) ); // Button text $wp_customize->add_setting( 'bongoto_hero_button_text', array( 'default' => __( 'Start Selling', 'bongoto' ), 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'bongoto_hero_button_text', array( 'label' => __( 'Button Text', 'bongoto' ), 'section' => 'bongoto_section_hero', 'type' => 'text', ) ); // Button URL $wp_customize->add_setting( 'bongoto_hero_button_url', array( 'default' => home_url( '/my-account' ), 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'bongoto_hero_button_url', array( 'label' => __( 'Button URL', 'bongoto' ), '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' ), '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 get_theme_mod( 'bongoto_hero_title' ); }, ) ); $wp_customize->selective_refresh->add_partial( 'bongoto_hero_subtitle', array( 'selector' => '.bt-hero__subtitle', 'render_callback' => function() { return get_theme_mod( 'bongoto_hero_subtitle' ); }, ) ); } } add_action( 'customize_register', 'bongoto_customize_register_hero' );