<?php
/**
 * Buconz Theme Customziers
 *
 * @package Buconz Starter
 */

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function buconz_starter_customize_register( $wp_customize ) {
	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
	$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
	
	if ( isset( $wp_customize->selective_refresh ) ) {
		$wp_customize->selective_refresh->add_partial( 'blogname', array(
			'selector'        => '.site-title a',
			'render_callback' => 'buconz_starter_customize_partial_blogname',
		) );
		$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
			'selector'        => '.site-description',
			'render_callback' => 'buconz_starter_customize_partial_blogdescription',
		) );
	}
}
add_action( 'customize_register', 'buconz_starter_customize_register' );

/**
 * Render the site title for the selective refresh partial.
 *
 * @return void
 */
function buconz_starter_customize_partial_blogname() {
	bloginfo( 'name' );
}

/**
 * Render the site tagline for the selective refresh partial.
 *
 * @return void
 */
function buconz_starter_customize_partial_blogdescription() {
	bloginfo( 'description' );
}

/**
 * Binds JS handlers to make Theme Modifier preview reload changes asynchronously.
 */
function buconz_starter_customizer_preview_js() {
	wp_enqueue_script( 'buconz-starter-customizer', get_template_directory_uri() . '/assets/js/buconz-starter-customizer.js', array( 'customize-preview' ), BUCONZ_STARTER_S_VERSION, true );
}
add_action( 'customize_preview_init', 'buconz_starter_customizer_preview_js' );


// Load customizer required panels

// Sanitize
require trailingslashit( get_template_directory() ) . '/inc/sanitize.php'; 

// Pro Version
require_once trailingslashit( get_template_directory() ) . '/inc/upgrade-to-pro/control.php';

//  Exbico Theme Settings Customizer
add_action( 'customize_register', 'buconz_starter_register_customizer_settings' );
function buconz_starter_register_customizer_settings( $wp_customize ) {
$wp_customize->add_panel( 'buconz_starter_theme_settings', array(
	'priority'               => 1,
	'capability'             => 'edit_theme_options',
	'title'                  => __( 'Buconz: Theme Settings', 'buconz-starter' ),
	'description'            => __( 'Theme All Settings', 'buconz-starter' ),
) );  

// Load Options
require_once trailingslashit( get_template_directory() ) . '/inc/buconz-theme-customizer/buconz-starter-global.php';
require_once trailingslashit( get_template_directory() ) . '/inc/buconz-theme-customizer/buconz-starter-page-banner.php';
}





//  Exbico Theme Settings Customizer Front
add_action( 'customize_register', 'exbico_register_customizer_front' );
function exbico_register_customizer_front( $wp_customize ) {
$wp_customize->add_panel( 'buconz_starter_front_option', array(
	'priority'               => 2,
	'capability'             => 'edit_theme_options',
	'title'                  => __( 'Buconz: Front Page', 'buconz-starter' ),
	'description'            => __( 'Buconz Theme sections', 'buconz-starter' ),
) );  

// Load Options
require trailingslashit( get_template_directory() ) . '/inc/buconz-theme-customizer/home-page/buconz-starter-hero-slider-customize.php';
require trailingslashit( get_template_directory() ) . '/inc/buconz-theme-customizer/home-page/buconz-starter-about-customize.php';
require trailingslashit( get_template_directory() ) . '/inc/buconz-theme-customizer/home-page/buconz-starter-services-customize.php';
require trailingslashit( get_template_directory() ) . '/inc/buconz-theme-customizer/home-page/buconz-starter-team-customize.php';
require trailingslashit( get_template_directory() ) . '/inc/buconz-theme-customizer/home-page/buconz-starter-blog-customize.php';
require trailingslashit( get_template_directory() ) . '/inc/buconz-theme-customizer/home-page/buconz-starter-cta-customize.php';
require trailingslashit( get_template_directory() ) . '/inc/buconz-theme-customizer/home-page/buconz-starter-funfact-customize.php';



// Upgrade to Pro
$wp_customize->register_section_type( 'buconz_starter_Customize_Section_Upsell' );
// Register sections.
$wp_customize->add_section(
	new buconz_starter_Customize_Section_Upsell(
		$wp_customize,
		'theme_upsell',
		array(
			'title'    => esc_html__( 'Buy Buconz (Elementor) ', 'buconz-starter' ),
			'pro_text' => esc_html__( 'Buy Now', 'buconz-starter' ),
			'pro_url'  => 'https://ordainit.com/consulting-wordpress-theme/',
			'priority' => 1,
		)
	)
);

// Buconz Customizer Scripts
function buconz_starter_customizer_control_scripts() {
	wp_enqueue_script( 'buconz-starter-customize-controls', get_template_directory_uri() . '/inc/upgrade-to-pro/customize-controls.js', array( 'customize-controls' ) );
	wp_enqueue_style( 'buconz-starter-customize-controls', get_template_directory_uri() . '/inc/upgrade-to-pro/customize-controls.css' );
}
add_action( 'customize_controls_enqueue_scripts', 'buconz_starter_customizer_control_scripts', 0 );




}







