get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->get_section( 'header_image' )->panel = 'ishop_header_panel'; $wp_customize->get_section( 'header_image' )->priority = '12'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'ishop_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'ishop_customize_partial_blogdescription', ) ); } //Titles class Ishop_Info extends WP_Customize_Control { public $type = 'info'; public $label = ''; public function render_content() { ?>

label ); ?>

add_section( 'slides', array( 'title' => 'Slides', 'priority' => 19, 'panel' => 'ishop_header_panel', ) ); $wp_customize->add_setting( 'first_slide', array( 'default' => get_template_directory_uri() . '/uploads/slider1.jpg', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_setting( 'text', array( 'default' => 'Sell Your Products with iShop', 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_setting( 'second_text', array( 'default' => 'With iShop responsive landing page template, you can promote your all products & textile projects. ', 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_setting( 'button_text', array( 'default' => 'View Gallery', 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); $wp_customize->add_setting( 'buttonlink_text', array( 'default' => '#gallery', 'sanitize_callback' => 'wp_filter_nohtml_kses' ) ); //First Image Slide $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'first_slide', array( 'label' => 'First Slide', 'section' => 'slides', 'type' => 'image', 'settings' => 'first_slide', ) ) ); //Add control first Text $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'text', array( 'label' => 'Slide Text', 'section' => 'slides', 'settings' => 'text', 'type' => 'text' ) ) ); //Add control second Text $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'second_text', array( 'label' => 'Second Slide Text', 'section' => 'slides', 'settings' => 'second_text', 'type' => 'text' ) ) ); //Add control first button Text $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'button_text', array( 'label' => 'button Text', 'section' => 'slides', 'settings' => 'button_text', 'type' => 'text' ) ) ); //Add control first button Text $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'buttonlink_text', array( 'label' => 'Button link Text', 'section' => 'slides', 'settings' => 'buttonlink_text', 'type' => 'text' ) ) ); $wp_customize->add_setting( 'second_slide', array( 'default' => get_template_directory_uri() . '/uploads/slider2.jpg', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'second_slide', array( 'label' => 'Second Slide', 'section' => 'slides', 'type' => 'image', 'settings' => 'second_slide', ) ) ); $wp_customize->add_setting( 'third_slide', array( 'default' => get_template_directory_uri() . '/uploads/slider3.jpg', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'third_slide', array( 'label' => 'Third Slide', 'section' => 'slides', 'type' => 'image', 'settings' => 'third_slide', ) ) ); $wp_customize->add_setting( 'fourth_slide', array( 'default' => get_template_directory_uri() . '/uploads/slider4.jpg', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'fourth_slide', array( 'label' => 'Fourth Slide', 'section' => 'slides', 'type' => 'image', 'settings' => 'fourth_slide', ) ) ); /** * Header */ $wp_customize->add_panel( 'ishop_header_panel', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Header area', 'ishop'), ) ); $wp_customize->add_section( 'ishop_header_type', array( 'title' => __('Header type', 'ishop'), 'priority' => 10, 'panel' => 'ishop_header_panel', ) ); //Front page $wp_customize->add_setting( 'front_header_type', array( 'default' => $defaults['front_header_type'], 'sanitize_callback' => 'ishop_sanitize_header', ) ); $wp_customize->add_control( 'front_header_type', array( 'type' => 'radio', 'label' => __('Homepage header type', 'ishop'), 'section' => 'ishop_header_type', 'description' => __('This option refers only to your homepage', 'ishop'), 'choices' => array( 'has-slider' => __('Slider', 'ishop'), 'nothing' => __('Only menu', 'ishop') ), ) ); //Site $wp_customize->add_setting( 'site_header_type', array( 'default' => $defaults['site_header_type'], 'sanitize_callback' => 'ishop_sanitize_header', ) ); $wp_customize->add_control( 'site_header_type', array( 'type' => 'radio', 'label' => __('Site header type', 'ishop'), 'section' => 'ishop_header_type', 'description' => __('This option refers to all pages except your homepage', 'ishop'), 'choices' => array( 'has-slider' => __('Slider', 'ishop'), 'nothing' => __('Only menu', 'ishop') ), ) ); } add_action( 'customize_register', 'ishop_customize_register' ); /** * Sanitize */ //Header type function ishop_sanitize_header( $input ) { if ( in_array( $input, array( 'has-slider', 'nothing' ), true ) ) { return $input; } } /** * Render the site title for the selective refresh partial. * * @return void */ function ishop_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function ishop_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function ishop_customize_preview_js() { wp_enqueue_script( 'ishop-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'ishop_customize_preview_js' );