get_section( 'colors' )->panel = 'theme_colors_panel'; $wp_customize->get_section( 'colors' )->title = esc_html__('Color Options','allinone'); $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'; $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-logo .custom-logo-name', 'render_callback' => 'allinone_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'allinone_customize_partial_blogdescription', ) ); } $allinone_default = allinone_get_default_theme_options(); $wp_customize->add_setting('logo_width_range', array( 'default' => $allinone_default['logo_width_range'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'allinone_sanitize_number_range', ) ); $wp_customize->add_control('logo_width_range', array( 'label' => esc_html__('Logo Width', 'allinone'), 'description' => esc_html__( 'Define logo size min-200 to max-700 (step-20)', 'allinone' ), 'section' => 'title_tagline', 'type' => 'range', 'input_attrs' => array( 'min' => 200, 'max' => 700, 'step' => 20, ), ) ); $wp_customize->add_setting('site_title_font_size', array( 'default' => $allinone_default['site_title_font_size'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'allinone_sanitize_number_range', ) ); $wp_customize->add_control('site_title_font_size', array( 'label' => esc_html__('Site Title Font size', 'allinone'), 'description' => esc_html__( 'Define Site title font size min-32 to max-150 (step-2)', 'allinone' ), 'section' => 'title_tagline', 'type' => 'range', 'input_attrs' => array( 'min' => 32, 'max' => 150, 'step' => 2, ), ) ); // Theme Options Panel. $wp_customize->add_panel( 'theme_option_panel', array( 'title' => esc_html__( 'Theme Options', 'allinone' ), 'priority' => 150, 'capability' => 'edit_theme_options', ) ); $wp_customize->add_panel( 'theme_general_settings', array( 'title' => esc_html__( 'General Settings', 'allinone' ), 'priority' => 10, 'capability' => 'edit_theme_options', ) ); $wp_customize->add_panel( 'theme_colors_panel', array( 'title' => esc_html__( 'Color Settings', 'allinone' ), 'priority' => 15, 'capability' => 'edit_theme_options', ) ); // Template Options $wp_customize->add_panel( 'theme_template_pannel', array( 'title' => esc_html__( 'Template Settings', 'allinone' ), 'priority' => 150, 'capability' => 'edit_theme_options', ) ); $wp_customize->add_setting( 'allinone_bg_text_color', array( 'default' => $allinone_default['allinone_bg_text_color'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'allinone_bg_text_color', array( 'label' => esc_html__( 'Primary Text Color', 'allinone' ), 'section' => 'colors', 'settings' => 'allinone_bg_text_color', ) ) ); // Register custom section types. $wp_customize->register_section_type( 'Allinone_Customize_Section_Upsell' ); // Register sections. $wp_customize->add_section( new Allinone_Customize_Section_Upsell( $wp_customize, 'theme_upsell', array( 'title' => esc_html__( 'Allinone Pro', 'allinone' ), 'pro_text' => esc_html__( 'Upgrade To Pro', 'allinone' ), 'pro_url' => esc_url('https://www.themeinwp.com/theme/allinone-pro/'), 'priority' => 1, ) ) ); } endif; add_action( 'customize_register', 'allinone_customize_register' ); /** * Customizer Enqueue scripts and styles. */ if (!function_exists('allinone_customizer_scripts')) : function allinone_customizer_scripts(){ wp_enqueue_script('jquery-ui-button'); wp_enqueue_style('allinone-customizer', get_template_directory_uri() . '/assets/lib/custom/css/customizer.css'); wp_enqueue_script('allinone-customizer', get_template_directory_uri() . '/assets/lib/custom/js/customizer.js', array('jquery','customize-controls'), '', 1); $ajax_nonce = wp_create_nonce('allinone_customizer_ajax_nonce'); wp_localize_script( 'allinone-customizer', 'allinone_customizer', array( 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), 'ajax_nonce' => $ajax_nonce, ) ); } endif; add_action('customize_controls_enqueue_scripts', 'allinone_customizer_scripts'); add_action('customize_controls_init', 'allinone_customizer_scripts'); /** * Customizer Enqueue scripts and styles. */ function allinone_customizer_repearer(){ wp_enqueue_style('allinone-repeater', get_template_directory_uri() . '/assets/lib/custom/css/repeater.css'); wp_enqueue_script('allinone-repeater', get_template_directory_uri() . '/assets/lib/custom/js/repeater.js', array('jquery','customize-controls'), '', 1); $allinone_post_category_list = allinone_post_category_list(); $cat_option = ''; if( $allinone_post_category_list ){ foreach( $allinone_post_category_list as $key => $cats ){ $cat_option .= ""; } } wp_localize_script( 'allinone-repeater', 'allinone_repeater', array( 'optionns' => " ". esc_html__('You May Like Block','allinone')."", 'categories' => $cat_option, 'new_section' => esc_html__('New Section','allinone'), 'upload_image' => esc_html__('Choose Image','allinone'), 'use_image' => esc_html__('Select','allinone'), ) ); wp_localize_script( 'allinone-customizer', 'allinone_customizer', array( 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), ) ); } add_action('customize_controls_enqueue_scripts', 'allinone_customizer_repearer'); /** * Render the site title for the selective refresh partial. * * @return void */ if (!function_exists('allinone_customize_partial_blogname')) : function allinone_customize_partial_blogname() { bloginfo( 'name' ); } endif; /** * Render the site tagline for the selective refresh partial. * * @return void */ if (!function_exists('allinone_customize_partial_blogdescription')) : function allinone_customize_partial_blogdescription() { bloginfo( 'description' ); } endif; /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function allinone_customize_preview_js() { wp_enqueue_script( 'allinone-customizer-preview', get_template_directory_uri() . '/assets/lib/custom/js/customizer-preview.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'allinone_customize_preview_js' );