Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function quality_header_customizer( $wp_customize ) {
- //Theme color
- class WP_color_Customize_Control extends WP_Customize_Control {
- public $type = 'new_menu';
- function render_content()
- {
- echo '<h3>Predefined Background Color Skins</h3>';
- $name = '_customize-color-radio-' . $this->id;
- foreach($this->choices as $key => $value ) {
- ?>
- <label>
- <input type="radio" value="<?php echo $key; ?>" name="<?php echo esc_attr( $name ); ?>" data-customize-setting-link="<?php echo esc_attr( $this->id ); ?>" <?php if($this->value() == $key){ echo 'checked="checked"'; } ?>>
- <img <?php if($this->value() == $key){ echo 'class="color_scheem_active"'; } ?> src="<?php echo get_template_directory_uri(); ?>/images/bg-patterns/<?php echo $value; ?>" alt="<?php echo esc_attr( $value ); ?>" />
- </label>
- <?php
- }
- ?>
- <script>
- jQuery(document).ready(function($) {
- $("#customize-control-quality_pro_options-style_sheet label img").click(function(){
- $("#customize-control-quality_pro_options-style_sheet label img").removeClass("color_scheem_active");
- $(this).addClass("color_scheem_active");
- });
- });
- </script>
- <?php
- }
- }
- class WP_back_Customize_Control extends WP_Customize_Control {
- public $type = 'new_menu';
- function render_content()
- {
- echo '<h3>Predefined Default Background</h3>';
- $name = '_customize-radio-' . $this->id;
- foreach($this->choices as $key => $value ) {
- ?>
- <label>
- <input type="radio" value="<?php echo $key; ?>" name="<?php echo esc_attr( $name ); ?>" data-customize-setting-link="<?php echo esc_attr( $this->id ); ?>" <?php if($this->value() == $key){ echo 'checked'; } ?>>
- <img <?php if($this->value() == $key){ echo 'class="background_active"'; } ?> src="<?php echo get_template_directory_uri(); ?>/images/bg-patterns/<?php echo esc_attr( $key ); ?>" alt="<?php echo esc_attr( $value ); ?>" />
- </label>
- <?php
- }
- ?>
- <script>
- jQuery(document).ready(function($) {
- $("#customize-control-quality_pro_options-back_image label img").click(function(){
- $("#customize-control-quality_pro_options-back_image label img").removeClass("background_active");
- $(this).addClass("background_active");
- });
- });
- </script>
- <?php
- }
- }
- /* Header Section */
- $wp_customize->add_panel( 'header_options', array(
- 'priority' => 450,
- 'capability' => 'edit_theme_options',
- 'title' => __('Header Settings', 'quality'),
- ) );
- $wp_customize->add_section( 'header_image' , array(
- 'title' => __('Theme Color Schemes Settings ', 'quality'),
- 'panel' => 'header_options',
- 'priority' => 200,
- ) );
- $wp_customize->add_setting(
- 'quality_pro_options[style_sheet]', array(
- 'default' => 'default.css',
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'sanitize_text_field',
- 'type' => 'option',
- ));
- $wp_customize->add_control(new WP_color_Customize_Control($wp_customize,'quality_pro_options[style_sheet]',
- array(
- 'label' => __('Predefined Colors', 'quality'),
- 'section' => 'header_image',
- 'type' => 'radio',
- 'choices' => array(
- 'default.css' => 'default.png',
- 'blue.css' => 'blue.png',
- 'green.css' => 'green.png',
- 'pink.css'=>'pink.png',
- 'golden.css' => 'golden.png',
- 'orange.css' => 'orange.png',
- 'purple.css'=>'purple.png',
- 'brown.css' => 'brown.png',
- 'teal.css' => 'teal.png'
- )
- )));
- $wp_customize->add_setting(
- 'quality_pro_options[link_color_enable]',
- array(
- 'default' => false,
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'sanitize_text_field',
- 'type' => 'option',
- )
- );
- $wp_customize->add_control(
- 'quality_pro_options[link_color_enable]',
- array(
- 'label' => __('Skin Color Enable','quality'),
- 'section' => 'header_image',
- 'type' => 'checkbox',
- )
- );
- $wp_customize->add_setting(
- 'quality_pro_options[link_color]', array(
- 'capability' => 'edit_theme_options',
- 'default' => '#f8504b',
- 'type' => 'option',
- ));
- $wp_customize->add_control(
- new WP_Customize_Color_Control(
- $wp_customize,
- 'quality_pro_options[link_color]',
- array(
- 'label' => __( 'Skin Color', 'quality' ),
- 'section' => 'header_image',
- 'settings' => 'quality_pro_options[link_color]',
- ) ) );
- $wp_customize->add_setting(
- 'quality_pro_options[layout_selector]', array(
- 'default' => 'wide',
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'sanitize_text_field',
- 'type' => 'option',
- ));
- $wp_customize->add_control('quality_pro_options[layout_selector]', array(
- 'label' => __('Theme Layout :', 'quality'),
- 'section' => 'header_image',
- 'priority' => 150,
- 'type' => 'select',
- 'choices' => array('wide' => 'wide','boxed' => 'boxed'),
- ));
- $wp_customize->add_setting(
- 'quality_pro_options[back_image]', array(
- 'default' => 'bg-img0.png',
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'sanitize_text_field',
- 'type' => 'option',
- ));
- $wp_customize->add_control(new WP_back_Customize_Control($wp_customize,'quality_pro_options[back_image]',
- array(
- 'label' => __('Predefined Default Background', 'quality'),
- 'section' => 'header_image',
- 'priority' => 160,
- 'type' => 'radio',
- 'choices' => array(
- 'bg-img0.png' => 'Pattern 0',
- 'bg_img1.png' => 'Pattern 1',
- 'bg_img2.png' => 'Pattern 2',
- 'bg_img3.png' => 'Pattern 3',
- 'bg_img4.png' => 'Pattern 4',
- 'bg_img5.png' => 'Pattern 5',
- 'bg_img6.png' => 'Pattern 6',
- 'bg_img7.png' => 'Pattern 7',
- )
- )));
- /* favicon option */
- $wp_customize->add_section( 'quality_favicon' , array(
- 'title' => __( 'Site favicon', 'quality' ),
- 'priority' => 300,
- 'description' => __( 'Upload a favicon', 'quality' ),
- 'panel' => 'header_options',
- ) );
- $wp_customize->add_setting('quality_pro_options[upload_image_favicon]', array(
- 'sanitize_callback' => 'esc_url_raw',
- 'capability' => 'edit_theme_options',
- 'type' => 'option',
- ) );
- $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'quality_pro_options[upload_image_favicon]', array(
- 'label' => __( 'Choose your favicon (ideal width and height is 16x16 or 32x32)', 'quality' ),
- 'section' => 'quality_favicon',
- ) ) );
- //Header social Icon
- $wp_customize->add_section(
- 'header_social_icon',
- array(
- 'title' => 'Social Link ',
- 'priority' => 400,
- 'panel' => 'header_options',
- )
- );
- //Show and hide Header Social Icons
- $wp_customize->add_setting(
- 'quality_pro_options[header_social_media_enabled]'
- ,
- array(
- 'default' => true,
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'sanitize_text_field',
- 'type' => 'option',
- )
- );
- $wp_customize->add_control(
- 'quality_pro_options[header_social_media_enabled]',
- array(
- 'label' => __('Hide Social icons','quality'),
- 'section' => 'header_social_icon',
- 'type' => 'checkbox',
- )
- );
- // Facebook link
- $wp_customize->add_setting(
- 'quality_pro_options[social_media_facebook_link]',
- array(
- 'default' => '#',
- 'sanitize_callback' => 'sanitize_text_field',
- 'type' => 'option',
- )
- );
- $wp_customize->add_control(
- 'quality_pro_options[social_media_facebook_link]',
- array(
- 'label' => __('Facebook Links:','quality'),
- 'section' => 'header_social_icon',
- 'type' => 'text',
- )
- );
- //twitter link
- $wp_customize->add_setting(
- 'quality_pro_options[social_media_twitter_link]',
- array(
- 'default' => '#',
- 'type' => 'theme_mod',
- 'sanitize_callback' => 'sanitize_text_field',
- 'type' => 'option',
- )
- );
- $wp_customize->add_control(
- 'quality_pro_options[social_media_twitter_link]',
- array(
- 'label' => __('Twitter Link:','quality'),
- 'section' => 'header_social_icon',
- 'type' => 'text',
- )
- );
- //Linkdin link
- $wp_customize->add_setting(
- 'quality_pro_options[social_media_linkedin_link]' ,
- array(
- 'default' => '#',
- 'sanitize_callback' => 'sanitize_text_field',
- 'type' => 'option',
- )
- );
- $wp_customize->add_control(
- 'quality_pro_options[social_media_linkedin_link]',
- array(
- 'label' => __('snapchat Links:','quality'),
- 'section' => 'header_social_icon',
- 'type' => 'text',
- )
- );
- //Google plus
- $wp_customize->add_setting(
- 'quality_pro_options[social_media_google_plus]' ,
- array(
- 'default' => '#',
- 'sanitize_callback' => 'sanitize_text_field',
- 'type' => 'option',
- )
- );
- $wp_customize->add_control(
- 'quality_pro_options[social_media_google_plus]',
- array(
- 'label' => __('Instagram Links:','quality'),
- 'section' => 'header_social_icon',
- 'type' => 'text',
- )
- );
- //youtub
- $wp_customize->add_setting(
- 'quality_pro_options[social_youtub]' ,
- array(
- 'default' => '#',
- 'sanitize_callback' => 'sanitize_text_field',
- 'type' => 'option',
- )
- );
- $wp_customize->add_control(
- 'quality_pro_options[social_youtub]',
- array(
- 'label' => __('Youtub Links:','quality'),
- 'section' => 'header_social_icon',
- 'type' => 'text',
- )
- );
- //Header logo setting
- $wp_customize->add_section( 'header_logo' , array(
- 'title' => __('Header Logo setting', 'quality'),
- 'panel' => 'header_options',
- 'priority' => 400,
- ) );
- $wp_customize->add_setting(
- 'quality_pro_options[upload_image_logo]'
- , array(
- 'default' => '',
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'esc_url_raw',
- 'type' => 'option',
- ));
- $wp_customize->add_control(
- new WP_Customize_Image_Control(
- $wp_customize,
- 'quality_pro_options[upload_image_logo]',
- array(
- 'label' => __( 'Upload a 150x150 for Logo Image', 'quality' ),
- 'section' => 'header_logo',
- 'priority' => 50,
- )
- )
- );
- //Enable/Disable logo text
- $wp_customize->add_setting(
- 'quality_pro_options[text_title]',array(
- 'default' => true,
- 'sanitize_callback' => 'sanitize_text_field',
- 'type' => 'option'
- ));
- $wp_customize->add_control(
- 'quality_pro_options[text_title]',
- array(
- 'type' => 'checkbox',
- 'label' => __('Enable/Disabe Logo','quality'),
- 'section' => 'header_logo',
- 'priority' => 100,
- )
- );
- //Logo width
- $wp_customize->add_setting(
- 'quality_pro_options[width]',array(
- 'sanitize_callback' => 'sanitize_text_field',
- 'default' => 200,
- 'type' => 'option',
- ));
- $wp_customize->add_control(
- 'quality_pro_options[width]',
- array(
- 'type' => 'text',
- 'label' => __('Enter Logo Width','quality'),
- 'section' => 'header_logo',
- 'priority' => 400,
- )
- );
- //Logo Height
- $wp_customize->add_setting(
- 'quality_pro_options[height]',array(
- 'sanitize_callback' => 'sanitize_text_field',
- 'default' => 80,
- 'type'=>'option',
- ));
- $wp_customize->add_control(
- 'quality_pro_options[height]',
- array(
- 'type' => 'text',
- 'label' => __('Enter Logo Height','quality'),
- 'section' => 'header_logo',
- 'priority' =>410,
- )
- );
- //Text logo
- $wp_customize->add_setting(
- 'quality_pro_options[text_title]'
- ,array(
- 'default' => true,
- 'sanitize_callback' => 'sanitize_text_field',
- 'type' =>'option',
- ));
- $wp_customize->add_control(
- 'quality_pro_options[text_title]',
- array(
- 'type' => 'checkbox',
- 'label' => __('Show Logo text','quality'),
- 'section' => 'header_logo',
- 'priority' => 200,
- )
- );
- //Custom css
- $wp_customize->add_section( 'custom_css' , array(
- 'title' => __('Custom css', 'quality'),
- 'panel' => 'header_options',
- 'priority' => 100,
- ) );
- $wp_customize->add_setting(
- 'quality_pro_options[webrit_custom_css]'
- , array(
- 'default' => '',
- 'capability' => 'edit_theme_options',
- 'sanitize_callback' => 'sanitize_text_field',
- 'type'=> 'option',
- ));
- $wp_customize->add_control( 'quality_pro_options[webrit_custom_css]', array(
- 'label' => __('Custom css snippet:', 'quality'),
- 'section' => 'custom_css',
- 'type' => 'textarea',
- 'priority' => 100,
- ));
- }
- add_action( 'customize_register', 'quality_header_customizer' );
- ?>
Add Comment
Please, Sign In to add comment