get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->get_section( 'colors' )->panel = 'theme_colors_panel'; $wp_customize->get_section( 'colors' )->title = esc_html__('Color Options','ashlar'); $wp_customize->get_section( 'title_tagline' )->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' => 'ashlar_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'ashlar_customize_partial_blogdescription', ) ); } $ashlar_default = ashlar_get_default_theme_options(); $wp_customize->add_setting('logo_width_range', array( 'default' => $ashlar_default['logo_width_range'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'ashlar_sanitize_number_range', ) ); $wp_customize->add_control('logo_width_range', array( 'label' => esc_html__('Logo With', 'ashlar'), 'description' => esc_html__( 'Define logo size min-200 to max-700 (step-20)', 'ashlar' ), 'section' => 'title_tagline', 'type' => 'range', 'input_attrs' => array( 'min' => 200, 'max' => 700, 'step' => 20, ), ) ); // Theme Options Panel. $wp_customize->add_panel( 'theme_option_panel', array( 'title' => esc_html__( 'Theme Options', 'ashlar' ), 'priority' => 150, 'capability' => 'edit_theme_options', ) ); $wp_customize->add_panel( 'theme_general_settings', array( 'title' => esc_html__( 'General Settings', 'ashlar' ), 'priority' => 10, 'capability' => 'edit_theme_options', ) ); $wp_customize->add_panel( 'theme_colors_panel', array( 'title' => esc_html__( 'Color Settings', 'ashlar' ), 'priority' => 15, 'capability' => 'edit_theme_options', ) ); // Theme Options Panel. $wp_customize->add_panel( 'theme_footer_option_panel', array( 'title' => esc_html__( 'Footer Setting', 'ashlar' ), 'priority' => 150, 'capability' => 'edit_theme_options', ) ); // Template Options $wp_customize->add_panel( 'theme_template_pannel', array( 'title' => esc_html__( 'Template Settings', 'ashlar' ), 'priority' => 150, 'capability' => 'edit_theme_options', ) ); // Register custom section types. $wp_customize->register_section_type( 'Ashlar_Customize_Section_Upsell' ); // Register sections. $wp_customize->add_section( new Ashlar_Customize_Section_Upsell( $wp_customize, 'theme_upsell', array( 'title' => esc_html__( 'Ashlar Pro', 'ashlar' ), 'pro_text' => esc_html__( 'Purchase', 'ashlar' ), 'pro_url' => esc_url('https://www.themeinwp.com/theme/ashlar-pro/'), 'priority' => 1, ) ) ); } endif; add_action( 'customize_register', 'ashlar_customize_register' ); /** * Customizer Enqueue scripts and styles. */ if (!function_exists('ashlar_customizer_scripts')) : function ashlar_customizer_scripts(){ wp_enqueue_script('jquery-ui-button'); wp_enqueue_style('ashlar-repeater', get_template_directory_uri() . '/assets/lib/custom/css/repeater.css'); wp_enqueue_style('ashlar-customizer', get_template_directory_uri() . '/assets/lib/custom/css/customizer.css'); wp_enqueue_script('ashlar-customizer', get_template_directory_uri() . '/assets/lib/custom/js/customizer.js', array('jquery','customize-controls'), '', 1); wp_enqueue_script('ashlar-repeater', get_template_directory_uri() . '/assets/lib/custom/js/repeater.js', array('jquery','customize-controls'), '', 1); $ashlar_post_category_list = ashlar_post_category_list(); $cat_option = ''; if( $ashlar_post_category_list ){ foreach( $ashlar_post_category_list as $key => $cats ){ $cat_option .= ""; } } wp_localize_script( 'ashlar-repeater', 'ashlar_repeater', array( 'categories' => $cat_option, 'upload_image' => esc_html__('Choose Image','ashlar'), 'use_image' => esc_html__('Select','ashlar'), ) ); $ajax_nonce = wp_create_nonce('ashlar_ajax_nonce'); wp_localize_script( 'ashlar-customizer', 'ashlar_customizer', array( 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), 'ajax_nonce' => $ajax_nonce, ) ); } endif; add_action('customize_controls_enqueue_scripts', 'ashlar_customizer_scripts'); add_action('customize_controls_init', 'ashlar_customizer_scripts'); /** * Render the site title for the selective refresh partial. * * @return void */ if (!function_exists('ashlar_customize_partial_blogname')) : function ashlar_customize_partial_blogname() { bloginfo( 'name' ); } endif; /** * Render the site tagline for the selective refresh partial. * * @return void */ if (!function_exists('ashlar_customize_partial_blogdescription')) : function ashlar_customize_partial_blogdescription() { bloginfo( 'description' ); } endif; add_action('wp_ajax_ashlar_customizer_font_weight', 'ashlar_customizer_font_weight_callback'); add_action('wp_ajax_nopriv_ashlar_customizer_font_weight', 'ashlar_customizer_font_weight_callback'); // Recommendec Post Ajax Call Function. function ashlar_customizer_font_weight_callback() { if ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_POST['_wpnonce'] ), 'ashlar_ajax_nonce' ) && isset( $_POST['currentfont'] ) && sanitize_text_field( wp_unslash( $_POST['currentfont'] ) ) ) { $currentfont = sanitize_text_field( wp_unslash( $_POST['currentfont'] ) ); $headings_fonts_property = Ashlar_Fonts::ashlar_get_fonts_property( $currentfont ); foreach( $headings_fonts_property['weight'] as $key => $value ){ echo ''; } } wp_die(); }