get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->remove_setting( 'display_header_text' ); $wp_customize->remove_control( 'display_header_text' ); /** * Textarea customize control class. */ if ( class_exists( 'WP_Customize_Control' ) ) : class Kciaotime_Customize_Textarea_Control extends WP_Customize_Control { public $type = 'textarea'; public function render_content() { ?> add_section('kciaotime_column_slideshow', array( 'title' => __('Column & Slideshow', 'kciaotime'), 'description' => '', 'priority' => 1, )); // Column Layout $wp_customize->add_setting('kciaotime_column_layout', array( 'default' => 2, 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_column_layout', )); $wp_customize->add_control('column_layout', array( 'label' => __('Select Column Layout for the page of the home, archive, category, search & tag.', 'kciaotime'), 'section' => 'kciaotime_column_slideshow', 'settings' => 'kciaotime_column_layout', 'type' => 'radio', 'choices' => array( '1' => 'Two column', '2' => 'Three column', ), 'priority' => 1, )); // Custom Slideshow $wp_customize->add_setting('kciaotime_custom_slideshow', array( 'default' => 2, 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_column_layout', )); $wp_customize->add_control('custom_slideshow', array( 'label' => __('Select Size of Slideshow', 'kciaotime'), 'section' => 'kciaotime_column_slideshow', 'settings' => 'kciaotime_custom_slideshow', 'type' => 'radio', 'choices' => array( '1' => 'Full width', '2' => 'Large', ), 'priority' => 2, )); // Display Slideshow $wp_customize->add_setting('kciaotime_display_slideshow', array( 'default' => 0, 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_checkbox', )); $wp_customize->add_control('display_slideshow', array( 'settings' => 'kciaotime_display_slideshow', 'label' => __('Display Slideshow?', 'kciaotime'), 'section' => 'kciaotime_column_slideshow', 'type' => 'checkbox', 'priority' => 3, )); // Post Type Image Slideshow $wp_customize->add_setting('kciaotime_posttype_slideshow',array( 'default' => 'page', 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_text_attribute', ) ); $wp_customize ->add_control(new Kciaotime_Customize_Textarea_Control($wp_customize, 'posttype_slideshow', array( 'label' => __('Input post type just for custom slider, separated by commas if use more than one of post type. This support post type from plugin installed. Example: ( default blog: "post", "page" )', 'kciaotime'), 'section' => 'kciaotime_column_slideshow', 'settings' => 'kciaotime_posttype_slideshow', 'type' => 'textarea', 'priority' => 4, ) ) ); // Display Post Thumbnail Only $wp_customize->add_setting('kciaotime_post_thumbnail_only', array( 'default' => '' . __('If you just want to display a thumbnail on a post in the home, this require resizing images. Upgrade Now!', 'kciaotime') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_text_attribute', )); $wp_customize->add_control( new Kciaotime_Customize_Info_Control($wp_customize, 'post_tumbnail_only', array( 'label' => __('Do You just want to display post thumbnail only in the homepage?', 'kciaotime'), 'section' => 'kciaotime_column_slideshow', 'settings' => 'kciaotime_post_thumbnail_only', 'type' => 'info', 'priority' => 5, ))); /*----------------------------------------------------------------------------------------*/ /* Layout Options Section /*----------------------------------------------------------------------------------------*/ $wp_customize->add_section('kciaotime_layout_options', array( 'title' => __('Layout Options', 'kciaotime'), 'description' => '', 'priority' => 2, )); // Display Favicon $wp_customize->add_setting('kciaotime_display_favicon_icon', array( 'default' => 0, 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_checkbox', )); $wp_customize->add_control('display_favicon_icon', array( 'settings' => 'kciaotime_display_favicon_icon', 'label' => __('Do you want to display favicon?', 'kciaotime'), 'section' => 'kciaotime_layout_options', 'type' => 'checkbox', 'priority' => 1, )); // Upload Favicon Icon $wp_customize->add_setting('kciaotime_upload_favicon_icon', array( 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'upload_favicon_icon', array( 'label' => __('Upload Favicon:', 'kciaotime'), 'section' => 'kciaotime_layout_options', 'settings' => 'kciaotime_upload_favicon_icon', 'priority' => 2, ))); // Upload Header Ads Image $wp_customize->add_setting('kciaotime_upload_header_ads', array( 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'upload_header_ads', array( 'label' => __('Upload Header Ads Image:', 'kciaotime'), 'section' => 'kciaotime_layout_options', 'settings' => 'kciaotime_upload_header_ads', 'priority' => 3, ))); // Header Ads URL $wp_customize->add_setting('kciaotime_header_ads_url',array( 'default' => '', 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_text_attribute', ) ); $wp_customize ->add_control(new Kciaotime_Customize_Textarea_Control($wp_customize, 'header_ads_url', array( 'label' => __('Input Full URL Header Ads', 'kciaotime'), 'section' => 'kciaotime_layout_options', 'settings' => 'kciaotime_header_ads_url', 'type' => 'textarea', 'priority' => 4, ) ) ); // Sidebar Layout $wp_customize->add_setting('kciaotime_sidebar_layout', array( 'default' => '' . __('Use this option to set the layout of the sidebar. Upgrade Now!', 'kciaotime') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_text_attribute', )); $wp_customize->add_control( new Kciaotime_Customize_Info_Control($wp_customize, 'sidebar_layout', array( 'label' => __('Sidebar Layout', 'kciaotime'), 'section' => 'kciaotime_layout_options', 'settings' => 'kciaotime_sidebar_layout', 'type' => 'info', 'priority' => 5, ))); // New Excerpt Length $wp_customize->add_setting('kciaotime_excerpt_length_theme', array( 'default' => '' . __('Set the excerpt length for the post in the home. Upgrade Now!', 'kciaotime') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_text_attribute', )); $wp_customize->add_control( new Kciaotime_Customize_Info_Control($wp_customize, 'excerpt_length_theme', array( 'label' => __('Excerpt length the post in the home', 'kciaotime'), 'section' => 'kciaotime_layout_options', 'settings' => 'kciaotime_excerpt_length_theme', 'type' => 'info', 'priority' => 6, ))); // Read More Text $wp_customize->add_setting('kciaotime_readmore_text_theme', array( 'default' => '' . __('Input text to display of the read more link. Upgrade Now!', 'kciaotime') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_text_attribute', )); $wp_customize->add_control( new Kciaotime_Customize_Info_Control($wp_customize, 'readmore_text_theme', array( 'label' => __('Display text of the read more link', 'kciaotime'), 'section' => 'kciaotime_layout_options', 'settings' => 'kciaotime_readmore_text_theme', 'type' => 'info', 'priority' => 7, ))); // Display Footer Widget $wp_customize->add_setting('kciaotime_display_footer_widget', array( 'default' => 0, 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_checkbox', )); $wp_customize->add_control('display_footer_widget', array( 'settings' => 'kciaotime_display_footer_widget', 'label' => __('Do You want to display Footer Widget?', 'kciaotime'), 'section' => 'kciaotime_layout_options', 'type' => 'checkbox', 'priority' => 8, )); // Footer Tagline $wp_customize->add_setting('kciaotime_footer_tagline', array( 'default' => '' . __('Change the tagline about your site, which will display on the bottom section of the footer. This section supports html tags if desired. The text is wrapped in a paragraph element for formatting. Upgrade Now!', 'kciaotime') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_text_attribute', )); $wp_customize->add_control( new Kciaotime_Customize_Info_Control($wp_customize, 'footer_tagline', array( 'label' => __('Footer Bottom Tagline', 'kciaotime'), 'section' => 'kciaotime_layout_options', 'settings' => 'kciaotime_footer_tagline', 'type' => 'info', 'priority' => 9, ))); /*----------------------------------------------------------------------------------------*/ /* Images Resize Section /*----------------------------------------------------------------------------------------*/ $wp_customize->add_section('kciaotime_images_resize_section', array( 'title' => __('Images Resize', 'kciaotime'), 'description' => 'Kciaotime PRO Support Only!', 'priority' => 3, )); // PRO Options $wp_customize->add_setting('kciaotime_images_resize', array( 'default' => '' . __('Allows you to change the size of images in posts on every page of your blog. Upgrade Now!', 'kciaotime') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_text_attribute', )); $wp_customize->add_control( new Kciaotime_Customize_Info_Control($wp_customize, 'images_resize', array( 'label' => __('Kciaotime PRO Options!', 'kciaotime'), 'section' => 'kciaotime_images_resize_section', 'settings' => 'kciaotime_images_resize', 'type' => 'info', ))); /*----------------------------------------------------------------------------------------*/ /* Background Color Section /*----------------------------------------------------------------------------------------*/ $wp_customize->add_section('kciaotime_background_color_section', array( 'title' => __('Background Color', 'kciaotime'), 'description' => 'Kciaotime PRO Support Only!', 'priority' => 4, )); // PRO Options $wp_customize->add_setting('kciaotime_background_color', array( 'default' => '' . __('Allows you to change the background in each area on your blog page. Upgrade Now!', 'kciaotime') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_text_attribute', )); $wp_customize->add_control( new Kciaotime_Customize_Info_Control($wp_customize, 'background_color', array( 'label' => __('Kciaotime PRO Options!', 'kciaotime'), 'section' => 'kciaotime_background_color_section', 'settings' => 'kciaotime_background_color', 'type' => 'info', ))); /*----------------------------------------------------------------------------------------*/ /* Text & Links Color Section /*----------------------------------------------------------------------------------------*/ $wp_customize->add_section('kciaotime_text_color_section', array( 'title' => __('Texts & Links Color', 'kciaotime'), 'description' => 'Kciaotime PRO Support Only!', 'priority' => 5, )); // PRO Options $wp_customize->add_setting('kciaotime_text_color', array( 'default' => '' . __('With this option, you can change the color of text and links in almost all parts of the area of the blog, or align with the background that you change. Upgrade Now!', 'kciaotime') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_text_attribute', )); $wp_customize->add_control( new Kciaotime_Customize_Info_Control($wp_customize, 'text_color', array( 'label' => __('Kciaotime PRO Options!', 'kciaotime'), 'section' => 'kciaotime_text_color_section', 'settings' => 'kciaotime_text_color', 'type' => 'info', ))); /*----------------------------------------------------------------------------------------*/ /* Tracking Code, Script & CSS Section /*----------------------------------------------------------------------------------------*/ $wp_customize->add_section('kciaotime_code_section', array( 'title' => __('Tracking Code, Script & CSS', 'kciaotime'), 'description' => 'Kciaotime PRO Support Only!', 'priority' => 6, )); // PRO Options $wp_customize->add_setting('kciaotime_tracking_code', array( 'default' => '' . __('Add your site in Google Webmaster by attaching a tracking code, analitycs, and tagmanager. You can also add code your own scripts and css, that will added into header and footer. Upgrade Now!', 'kciaotime') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'kciaotime_sanitize_text_attribute', )); $wp_customize->add_control( new Kciaotime_Customize_Info_Control($wp_customize, 'tracking_code', array( 'label' => __('Kciaotime PRO Options!', 'kciaotime'), 'section' => 'kciaotime_code_section', 'settings' => 'kciaotime_tracking_code', 'type' => 'info', ))); } add_action( 'customize_register', 'kciaotime_customize_register' ); /** * Sanitize the Column Layout value. */ function kciaotime_sanitize_column_layout( $column ) { if ( ! in_array( $column, array( '1', '2', '3' ) ) ) { $column = '2'; } return $column; } /** * Sanitize the checkbox. */ function kciaotime_sanitize_checkbox( $input ) { if ( 1 == $input ) { return true; } else { return false; } } /** * Sanitize text attribute. */ function kciaotime_sanitize_text_attribute( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function kciaotime_customize_preview_js() { wp_enqueue_script( 'kciaotime_customizer', get_template_directory_uri() . '/lib/js/customizer.js', array( 'customize-preview' ), '20130508', true ); } add_action( 'customize_preview_init', 'kciaotime_customize_preview_js' ); /** * Registers script */ function kciaotime_registers() { wp_register_script( 'kciaotime_customizer_script', get_template_directory_uri() . '/lib/js/kciaotime.js', array('jquery'), '2015', true ); wp_enqueue_script( 'kciaotime_customizer_script' ); wp_localize_script( 'kciaotime_customizer_script', 'kciaotime_buttons', array( 'doc' => __( 'Upgrade to Kciaotime Pro!', 'kciaotime' ), 'pro' => __( esc_html( __('donate', 'kciaotime') ), 'kciaotime' ) ) ); } add_action( 'customize_controls_enqueue_scripts', 'kciaotime_registers' );