get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->get_section( 'static_front_page' )->panel = 'homepage_option_panel'; $wp_customize->get_section( 'static_front_page' )->title = esc_html__('Homepage Page/Post Option','bozu'); $wp_customize->get_section( 'colors' )->panel = 'theme_colors_panel'; $wp_customize->get_section( 'colors' )->title = esc_html__('Color Options','bozu'); $wp_customize->get_section( 'title_tagline' )->panel = 'theme_general_settings'; $wp_customize->get_section( 'header_image' )->panel = 'theme_general_settings'; $wp_customize->get_section( 'background_image' )->panel = 'theme_general_settings'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'bozu_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'bozu_customize_partial_blogdescription', ) ); } $wp_customize->add_setting('logo_width_range', array( 'default' => $bozu_default['logo_width_range'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bozu_sanitize_number_range', ) ); $wp_customize->add_control('logo_width_range', array( 'label' => esc_html__('Logo With', 'bozu'), 'description' => esc_html__( 'Define logo size min-200 to max-700 (step-20)', 'bozu' ), 'section' => 'title_tagline', 'type' => 'range', 'input_attrs' => array( 'min' => 200, 'max' => 700, 'step' => 20, ), ) ); // Homepage Options Panel. $wp_customize->add_panel( 'homepage_option_panel', array( 'title' => esc_html__( 'HomePage Options', 'bozu' ), 'priority' => 150, 'capability' => 'edit_theme_options', ) ); // Theme Options Panel. $wp_customize->add_panel( 'theme_option_panel', array( 'title' => esc_html__( 'Theme Options', 'bozu' ), 'priority' => 150, 'capability' => 'edit_theme_options', ) ); $wp_customize->add_panel( 'theme_general_settings', array( 'title' => esc_html__( 'General Settings', 'bozu' ), 'priority' => 10, 'capability' => 'edit_theme_options', ) ); $wp_customize->add_panel( 'theme_colors_panel', array( 'title' => esc_html__( 'Color Settings', 'bozu' ), 'priority' => 15, 'capability' => 'edit_theme_options', ) ); // Theme Options Panel. $wp_customize->add_panel( 'theme_footer_option_panel', array( 'title' => esc_html__( 'Footer Setting', 'bozu' ), 'priority' => 150, 'capability' => 'edit_theme_options', ) ); // Template Options $wp_customize->add_panel( 'theme_template_pannel', array( 'title' => esc_html__( 'Template Settings', 'bozu' ), 'priority' => 150, 'capability' => 'edit_theme_options', ) ); $bozu_defaults = bozu_get_default_theme_options(); $home_section_arrange_vals_1 = get_theme_mod( 'home_section_arrange_vals_1', $bozu_defaults['home_section_arrange_vals_1'] ); $home_section_arrange_vals_1 = explode(",",$home_section_arrange_vals_1 ); $j = 1; foreach( $home_section_arrange_vals_1 as $home_section_arrange ){ if ($j <= 5) { $wp_customize->get_section( $home_section_arrange )->priority = $j; } $j ++; } // Register custom section types. $wp_customize->register_section_type( 'Bozu_Customize_Section_Upsell' ); // Register sections. $wp_customize->add_section( new Bozu_Customize_Section_Upsell( $wp_customize, 'theme_upsell', array( 'title' => esc_html__( 'Bozu Pro', 'bozu' ), 'pro_text' => esc_html__( 'Purchase', 'bozu' ), 'pro_url' => esc_url('https://www.themeinwp.com/theme/bozu-pro/'), 'priority' => 1, ) ) ); } endif; add_action( 'customize_register', 'bozu_customize_register' ); add_action( 'wp_ajax_bozu_arrange_home_section', 'bozu_arrange_home_section' ); add_action('wp_ajax_nopriv_bozu_arrange_home_section', 'bozu_arrange_home_section'); function bozu_arrange_home_section() { if ( isset( $_POST['sections'] ) ) { set_theme_mod( 'home_section_arrange_vals_1', wp_unslash( $_POST['sections'] ) ); } wp_die(); // this is required to terminate immediately and return a proper response } /** * Customizer Enqueue scripts and styles. */ if (!function_exists('bozu_customizer_scripts')) : function bozu_customizer_scripts(){ wp_enqueue_script('jquery-ui-button'); wp_enqueue_style('bozu-repeater', get_template_directory_uri() . '/assets/lib/custom/css/repeater.css'); wp_enqueue_style('bozu-customizer-controll', get_template_directory_uri() . '/assets/lib/custom/css/customizer.css'); wp_enqueue_script('bozu-repeater', get_template_directory_uri() . '/assets/lib/custom/js/repeater.js', array('jquery','customize-controls'), '', 1); wp_enqueue_script('bozu-customizer', get_template_directory_uri() . '/assets/lib/custom/js/customizer.js', array('jquery','customize-controls'), '', 1); wp_enqueue_script('bozu-re-customizer', get_template_directory_uri() . '/assets/lib/custom/js/re-customizer.js', array('jquery','customize-controls'), '', 1); $bozu_post_category_list = bozu_post_category_list(); $cat_option = ''; if( $bozu_post_category_list ){ foreach( $bozu_post_category_list as $key => $cats ){ $cat_option .= ""; } } wp_localize_script( 'bozu-repeater', 'bozu_repeater', array( 'categories' => $cat_option, 'upload_image' => esc_html__('Choose Image','bozu'), 'use_image' => esc_html__('Select','bozu'), ) ); $home_section_arrange_vals_1 = get_theme_mod( 'home_section_arrange_vals_1' ); $home_section_arrange_vals_1 = explode(",",$home_section_arrange_vals_1 ); $key_sidebar = ''; $home_url = esc_url( home_url('/') ); $ajax_nonce = wp_create_nonce('bozu_ajax_nonce'); wp_localize_script( 'bozu-re-customizer', 'bozu_re_customizer', array( 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), 'ajax_nonce' => $ajax_nonce, 'key_sidebar' => $key_sidebar, 'home_url' => $home_url, ) ); } endif; add_action('customize_controls_enqueue_scripts', 'bozu_customizer_scripts'); add_action('customize_controls_init', 'bozu_customizer_scripts'); /** * Render the site title for the selective refresh partial. * * @return void */ if (!function_exists('bozu_customize_partial_blogname')) : function bozu_customize_partial_blogname() { bloginfo( 'name' ); } endif; /** * Render the site tagline for the selective refresh partial. * * @return void */ if (!function_exists('bozu_customize_partial_blogdescription')) : function bozu_customize_partial_blogdescription() { bloginfo( 'description' ); } endif; add_action('wp_ajax_bozu_customizer_font_weight', 'bozu_customizer_font_weight_callback'); add_action('wp_ajax_nopriv_bozu_customizer_font_weight', 'bozu_customizer_font_weight_callback'); // Recommendec Post Ajax Call Function. function bozu_customizer_font_weight_callback() { if ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_POST['_wpnonce'] ), 'bozu_ajax_nonce' ) && isset( $_POST['currentfont'] ) && sanitize_text_field( wp_unslash( $_POST['currentfont'] ) ) ) { $currentfont = sanitize_text_field( wp_unslash( $_POST['currentfont'] ) ); $headings_fonts_property = Bozu_Fonts::bozu_get_fonts_property( $currentfont ); foreach( $headings_fonts_property['weight'] as $key => $value ){ echo ''; } } wp_die(); }