add_panel( 'bongoto_panel', array( 'title' => __( 'Bongoto Theme Options', 'bongoto' ), 'description' => __( 'Global theme options for hero, header, footer, and general settings.', 'bongoto' ), 'priority' => 160, // after Widgets/Menus ) ); // Section: General (quick toggles; detailed fields in options-general.php). $wp_customize->add_section( 'bongoto_section_general', array( 'title' => __( 'General', 'bongoto' ), 'priority' => 10, 'panel' => 'bongoto_panel', ) ); // Quick setting: Show Site Title (on/off) $wp_customize->add_setting( 'bongoto_show_site_title', array( 'default' => true, 'sanitize_callback' => 'bongoto_sanitize_checkbox', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'bongoto_show_site_title', array( 'label' => __( 'Show Site Title & Tagline', 'bongoto' ), 'description' => __( 'Toggle the textual site title/description next to the logo.', 'bongoto' ), 'section' => 'bongoto_section_general', 'type' => 'checkbox', ) ); // Quick setting: Logo max-height $wp_customize->add_setting( 'bongoto_logo_max_height', array( 'default' => 40, 'sanitize_callback' => function( $v ) { return bongoto_sanitize_int_range( $v, 16, 200, 40 ); }, 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'bongoto_logo_max_height', array( 'label' => __( 'Logo Max Height (px)', 'bongoto' ), 'section' => 'bongoto_section_general', 'type' => 'number', 'input_attrs' => array( 'min' => 16, 'max' => 200, 'step' => 1 ), ) ); // Section shells for Header/Footer (actual fields live in options-* files). $wp_customize->add_section( 'bongoto_section_header', array( 'title' => __( 'Header', 'bongoto' ), 'priority' => 20, 'panel' => 'bongoto_panel', ) ); $wp_customize->add_section( 'bongoto_section_footer', array( 'title' => __( 'Footer', 'bongoto' ), 'priority' => 40, 'panel' => 'bongoto_panel', // If Pro inactive, clarify that copyright text is Pro-only. 'description' => $pro_active ? __( 'Footer layout and copyright settings.', 'bongoto' ) : __( 'Footer layout settings. (Copyright text editing is available in Bongoto Pro)', 'bongoto' ), ) ); /** * Selective refresh: site title/description. */ if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => function () { return esc_html( get_bloginfo( 'name' ) ); }, ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => function () { return esc_html( get_bloginfo( 'description', 'display' ) ); }, ) ); } } add_action( 'customize_register', 'bongoto_customize_register' ); /** * 2) Load field groups (split into files for cleanliness) * These files add settings/controls to the sections created above. */ function bongoto_customize_include_option_files() { $base = trailingslashit( get_template_directory() ) . 'inc/customizer/'; $files = array( 'sanitize.php', 'options-general.php', 'options-header.php', 'options-footer.php', 'options-hero.php', // ✅ NEW: Home Hero controls 'controls/class-sortable-control.php', ); foreach ( $files as $rel ) { $path = $base . ltrim( $rel, '/' ); if ( file_exists( $path ) ) { require_once $path; } } } add_action( 'after_setup_theme', 'bongoto_customize_include_option_files', 20 ); /** * 3) Live preview script (updates logo size/title visibility without reload) */ function bongoto_customize_live_preview_js() { $rel = 'assets/js/customizer.js'; $path = trailingslashit( get_template_directory() ) . $rel; if ( file_exists( $path ) ) { wp_enqueue_script( 'bongoto-customizer-live', trailingslashit( get_template_directory_uri() ) . $rel, array( 'customize-preview', 'jquery' ), function_exists( 'bongoto_file_version' ) ? bongoto_file_version( $rel ) : '1.0.0', true ); } } add_action( 'customize_preview_init', 'bongoto_customize_live_preview_js' ); /** * 4) Editor styles for Customizer controls (optional) */ function bongoto_customize_controls_assets() { // Small inline CSS to make our sections tidy. $css = ' #customize-controls .control-section#accordion-section-bongoto_section_general .description { opacity:.85 } '; wp_add_inline_style( 'customize-controls', $css ); } add_action( 'customize_controls_enqueue_scripts', 'bongoto_customize_controls_assets' ); /** * Show "Get Pro" or "Pro" badge beside the theme title in Customizer. */ add_action( 'customize_controls_print_footer_scripts', function() { $is_pro = apply_filters( 'bongoto/is_pro_active', false ); $pro_link = esc_url( 'https://bongoto.com/product/bongoto-pro-digital-marketplace-addon/' ); ?>