get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; } add_action( 'customize_register', 'rws_myself_customize_register' ); function rws_myself_custom( $wp_customize){ //Start of the Social Links section // Start of the Header Options // Header Options Area $wp_customize->add_panel('rws_myself_header_options', array( 'capabitity' => 'edit_theme_options', 'priority' => 40, 'title' => __('Header', 'avalanche') )); // Header Logo upload option $wp_customize->add_section('rws_myself_header_logo', array( 'priority' => 1, 'title' => __('Header Logo', 'avalanche'), 'panel' => 'rws_myself_header_options' )); $wp_customize->add_setting('rws_myself_header_logo_image', array( 'default' => '', //'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint' //'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'rws_myself_header_logo_image', array( 'label' => __('Upload logo for your header. Recommended image size is 150 X 150 pixels.', 'avalanche'), 'section' => 'rws_myself_header_logo', 'setting' => 'rws_myself_header_logo_image' ))); // Header slider which includes title and description $wp_customize->add_section('rws_myself_header_slider', array( 'priority' => 2, 'title' => __('Header Slider', 'avalanche'), 'panel' => 'rws_myself_header_options' )); //Header Title , Description and Slider $wp_customize->add_setting( 'hide_slider',array( 'sanitize_callback' => 'esc_attr' ) ); $wp_customize->add_control( 'hide_slider',array( 'type' => 'checkbox', 'label' => 'Hide slider', 'section' => 'rws_myself_header_slider', )); for ( $i = 1; $i <= 6; $i++ ) { $wp_customize->add_setting('rws_myself_header_title'.$i, array( 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('rws_myself_header_title'.$i, array( 'section' => 'rws_myself_header_slider', 'type' => 'text', 'capability' => 'edit_theme_options', 'label' => 'Header Title '.$i, )); $wp_customize->add_setting('rws_myself_header_description'.$i, array( 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('rws_myself_header_description'.$i, array( 'section' => 'rws_myself_header_slider', 'type' => 'textarea', 'capability' => 'edit_theme_options', 'label' => 'Header Description '.$i )); $wp_customize->add_setting('rws_myself_header_slider_image'.$i, array( 'default' => '', //'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr' //'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'rws_myself_header_slider_image'.$i, array( 'label' => 'Slider'.$i, 'section' => 'rws_myself_header_slider', 'setting' => 'rws_myself_header_slider_image'.$i ))); $wp_customize->add_setting('rws_myself_header_readmore'.$i, array( 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('rws_myself_header_readmore'.$i, array( 'section' => 'rws_myself_header_slider', 'type' => 'text', 'capability' => 'edit_theme_options', 'label' => 'Read More Link '.$i )); } //End of Header, Slider and Description // End of Header Options $wp_customize->add_section('rws_myself_social_links', array( 'priority' => 3, 'title' => __('Social Links', 'avalanche'), 'panel' => 'rws_myself_header_options' )); $wp_customize->add_setting('rws_myself_facebook_url', array( 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('rws_myself_facebook_url', array( 'section' => 'rws_myself_social_links', 'type' => 'text', 'capability' => 'edit_theme_options', 'label' => __( 'Facebook', 'avalanche') )); $wp_customize->add_setting('rws_myself_twitter_url', array( 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('rws_myself_twitter_url', array( 'section' => 'rws_myself_social_links', 'type' => 'text', 'capability' => 'edit_theme_options', 'label' => __( 'Twitter ', 'avalanche') )); $wp_customize->add_setting('rws_myself_google+_url', array( 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('rws_myself_google+_url', array( 'section' => 'rws_myself_social_links', 'type' => 'text', 'capability' => 'edit_theme_options', 'label' => __( 'Google + ', 'avalanche') )); $wp_customize->add_setting('rws_myself_linkedin_url', array( 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('rws_myself_linkedin_url', array( 'section' => 'rws_myself_social_links', 'type' => 'text', 'capability' => 'edit_theme_options', 'label' => __( 'LinkedIn', 'avalanche') )); $wp_customize->add_setting('rws_myself_instagram_url', array( 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('rws_myself_instagram_url', array( 'section' => 'rws_myself_social_links', 'type' => 'text', 'capability' => 'edit_theme_options', 'label' => __( 'Instagram', 'avalanche') )); $wp_customize->add_setting('rws_myself_youtube_url', array( 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('rws_myself_youtube_url', array( 'section' => 'rws_myself_social_links', 'type' => 'text', 'capability' => 'edit_theme_options', 'label' => __( 'Youtube', 'avalanche') )); /*$wp_customize->add_setting('rws_link_color',array( 'default' => '#1e73be', 'transport' => 'postMessage', 'sanitize_callback' => 'absint' )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array( 'label' => __( 'Link rws_myself Color', 'avalanche' ), 'section' => 'colors', 'settings' => 'rws_link_color' ) ) );*/ $wp_customize->add_setting( 'hide_service',array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'hide_service', array( 'type' => 'checkbox', 'label' => 'Hide service Part', 'section' => 'service', ) ); $wp_customize->add_section( 'service' , array( 'title' => __( 'Home/Front Service Content', 'avalanche' ), 'priority' => 60, 'description' => 'Insert featured image in particular page to show image in frontpage' ) ); for ( $count = 1; $count <= 3; $count++ ) { // Add color scheme setting and control. $wp_customize->add_setting( 'service-page-' . $count, array( 'default' => '', 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'service-page-' . $count, array( 'label' => __( 'Select Page', 'avalanche' ), 'section' => 'service', 'type' => 'dropdown-pages' ) ); $wp_customize->add_setting( 'service-icon-' .$count, array( 'default' =>'', 'sanitize_callback' => 'absint' )); $wp_customize->add_setting( 'service-icon1-' .$count, array( 'label' =>__('Service icon', 'avalanche'), 'section' => 'service', 'type' => 'text', 'sanitize_callback' => 'absint' )); $wp_customize->add_section( 'skills' , array( 'title' => __( 'Skills Section', 'avalanche' ), 'priority' => 70, 'description' => 'Insert your skills' ) ); $wp_customize->add_setting( 'hide_skill',array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'hide_skill',array( 'type' => 'checkbox', 'label' => 'Hide skill section', 'section' => 'skills', 'default' => 0 )); for ( $count = 1; $count <= 10; $count++ ) { // Add color scheme setting and control. $wp_customize->add_setting( 'skill-name' . $count, array( 'default' => '', 'sanitize_callback' => 'esc_attr' ) ); $wp_customize->add_control( 'skill-name' . $count, array( 'label' => __( 'Skill Name', 'avalanche' ), 'section' => 'skills', 'type' => 'text' ) ); $wp_customize->add_setting( 'skill-percent' .$count, array( 'default' =>'', 'sanitize_callback' => 'absint' )); $wp_customize->add_control( 'skill-percent' .$count, array( 'label' =>__('Skill %', 'avalanche'), 'section' => 'skills', 'type' => 'text' )); $wp_customize->add_setting('rws_link_color'.$count,array( 'transport' => 'postMessage', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color'.$count, array( 'label' => __( 'Background Color', 'avalanche' ), 'section' => 'skills', 'settings' => 'rws_link_color'.$count ) ) ); } //Footer Section $wp_customize->add_setting( 'hide_copyright',array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'hide_copyright',array( 'type' => 'checkbox', 'label' => 'Hide copyright text', 'section' => 'footer_section', )); $wp_customize->add_section('footer_section',array( 'title' => 'Footer', 'description' => 'This is a footer section.', 'priority' => 500, )); $wp_customize->add_setting( 'rws_contact_title',array( 'default' => '', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control( 'rws_contact_title',array( 'label' => 'Contact Title', 'section' => 'footer_section', 'type' => 'text', )); $wp_customize->add_setting( 'copyright_textbox',array( 'default' => 'Default copyright text', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control( 'copyright_textbox',array( 'label' => 'Copyright text', 'section' => 'footer_section', 'type' => 'text', )); $wp_customize->add_setting( 'rws_contact_home_phone' , array( 'transport' => 'refresh', 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'rws_contact_home_phone', array( 'label' => __( 'Home Phone ', 'avalanche' ), 'section' => 'footer_section', 'settings' => 'rws_contact_home_phone', ) ); $wp_customize->add_setting( 'rws_contact_mobile_phone' , array( 'transport' => 'refresh', 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'rws_contact_mobile_phone', array( 'label' => __( 'Mobile Phone ', 'avalanche' ), 'section' => 'footer_section', 'settings' => 'rws_contact_mobile_phone', ) ); $wp_customize->add_setting( 'rws_contact_email' , array( 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr' ) ); $wp_customize->add_control( 'rws_contact_email', array( 'label' => __( 'Email', 'avalanche' ), 'section' => 'footer_section', 'settings' => 'rws_contact_email', ) ); $wp_customize->add_setting( 'rws_contact_address' , array( 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr' ) ); $wp_customize->add_control( 'rws_contact_address', array( 'label' => __( 'Address', 'avalanche' ), 'section' => 'footer_section', 'settings' => 'rws_contact_address' ) ); $wp_customize->add_setting( 'rws_contact_fax' , array( 'transport' => 'refresh', 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'rws_contact_fax', array( 'label' => __( 'Fax', 'avalanche' ), 'section' => 'footer_section', 'settings' => 'rws_contact_fax', ) ); //About Section $wp_customize->add_setting( 'hide_about',array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'hide_about',array( 'type' => 'checkbox', 'label' => 'Hide about section', 'section' => 'rws_about', 'default' => 0 )); $wp_customize->add_section('rws_about',array( 'title' => 'Home/Front About Section', 'description' => 'This is a about section in home/front page.', 'priority' => 70, )); $wp_customize->add_setting('rws_about_title', array( 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('rws_about_title',array( 'label' => __('About Title', 'avalanche'), 'section' => 'rws_about', 'type' => 'text', 'settings' => 'rws_about_title' )); $wp_customize->add_setting('rws_about_description', array( 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('rws_about_description',array( 'label' => __('About Description', 'avalanche'), 'section' => 'rws_about', 'type' => 'textarea', 'settings' => 'rws_about_description' )); $wp_customize->add_setting('rws_about_image', array( 'default' => '', //'type' => 'option', 'capability' => 'edit_theme_options', //'sanitize_callback' => 'esc_url_raw' 'sanitize_callback' => 'absint' )); $wp_customize->add_control(new WP_Customize_Cropped_Image_Control($wp_customize, 'rws_about_image', array( 'label' => __('Upload your image . Recommended image size is 300 X 350 pixels.', 'avalanche'), 'section' => 'rws_about', 'setting' => 'rws_about_image', 'flex_width' => true, 'flex_height' => true, 'width' => 300, 'height' => 230 ))); //page layout options $wp_customize->add_setting( 'rws_myself_site_layout', array( 'default' => 'right-sidebar', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr' ) ); $wp_customize->add_control( 'rws_myself_site_layout', array( 'label' => __('Layout Options','avalanche'), 'section' => 'layout', 'settings' => 'rws_myself_site_layout', 'type' => 'select', 'choices' => array( 'right-sidebar' => __( 'Left Content - Primary Sidebar', 'avalanche' ), 'left-sidebar' => __( 'Primary Sidebar - Right Content', 'avalanche' ), 'no-sidebar' => __( 'No Sidebar', 'avalanche' ) ), ) ); $wp_customize->add_section('layout' , array( 'title' => __('Layout','avalanche'), )); } } add_action( 'customize_register', 'rws_myself_custom'); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function rws_myself_customize_preview_js() { wp_enqueue_script( 'rws_myself_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true ); } add_action( 'customize_preview_init', 'rws_myself_customize_preview_js' );