SHARE
TWEET

Untitled

a guest Jun 14th, 2016 18 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function quality_header_customizer( $wp_customize ) {
  3.  
  4. //Theme color
  5. class WP_color_Customize_Control extends WP_Customize_Control {
  6. public $type = 'new_menu';
  7.  
  8.        function render_content()
  9.        
  10.        {
  11.        echo '<h3>Predefined Background Color Skins</h3>';
  12.           $name = '_customize-color-radio-' . $this->id;
  13.           foreach($this->choices as $key => $value ) {
  14.             ?>
  15.                <label>
  16.                 <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"'; } ?>>
  17.                 <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 ); ?>" />
  18.                 </label>
  19.                
  20.             <?php
  21.           }
  22.           ?>
  23.           <script>
  24.             jQuery(document).ready(function($) {
  25.                 $("#customize-control-quality_pro_options-style_sheet label img").click(function(){
  26.                     $("#customize-control-quality_pro_options-style_sheet label img").removeClass("color_scheem_active");
  27.                     $(this).addClass("color_scheem_active");
  28.                 });
  29.             });
  30.           </script>
  31.           <?php
  32.        }
  33.  
  34. }
  35.  
  36.  
  37. class WP_back_Customize_Control extends WP_Customize_Control {
  38. public $type = 'new_menu';
  39.  
  40.        function render_content()
  41.        
  42.        {
  43.        echo '<h3>Predefined Default Background</h3>';
  44.           $name = '_customize-radio-' . $this->id;
  45.           foreach($this->choices as $key => $value ) {
  46.             ?>
  47.                <label>
  48.                 <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'; } ?>>
  49.                
  50.                 <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 ); ?>" />
  51.                 </label>
  52.             <?php
  53.           }
  54.           ?>
  55.           <script>
  56.             jQuery(document).ready(function($) {
  57.                 $("#customize-control-quality_pro_options-back_image label img").click(function(){
  58.                     $("#customize-control-quality_pro_options-back_image label img").removeClass("background_active");
  59.                     $(this).addClass("background_active");
  60.                 });
  61.             });
  62.           </script>
  63.           <?php
  64.        }
  65.  
  66. }
  67. /* Header Section */
  68.     $wp_customize->add_panel( 'header_options', array(
  69.         'priority'       => 450,
  70.         'capability'     => 'edit_theme_options',
  71.         'title'      => __('Header Settings', 'quality'),
  72.     ) );
  73.    
  74.    
  75.     $wp_customize->add_section( 'header_image' , array(
  76.         'title'      => __('Theme Color Schemes Settings ', 'quality'),
  77.         'panel'  => 'header_options',
  78.         'priority'   => 200,
  79.     ) );
  80.     $wp_customize->add_setting(
  81.     'quality_pro_options[style_sheet]', array(
  82.         'default'        => 'default.css',
  83.         'capability'     => 'edit_theme_options',
  84.         'sanitize_callback' => 'sanitize_text_field',
  85.         'type' => 'option',
  86.     ));
  87.    
  88.     $wp_customize->add_control(new WP_color_Customize_Control($wp_customize,'quality_pro_options[style_sheet]',
  89.     array(
  90.         'label'   => __('Predefined Colors', 'quality'),
  91.         'section' => 'header_image',
  92.         'type' => 'radio',
  93.         'choices' => array(
  94.             'default.css' => 'default.png',
  95.             'blue.css' => 'blue.png',
  96.             'green.css' => 'green.png',
  97.             'pink.css'=>'pink.png',
  98.             'golden.css' => 'golden.png',
  99.             'orange.css' => 'orange.png',
  100.             'purple.css'=>'purple.png',
  101.             'brown.css' => 'brown.png',
  102.             'teal.css' => 'teal.png'
  103.     )
  104.    
  105.     )));
  106.    
  107.    
  108.     $wp_customize->add_setting(
  109.     'quality_pro_options[link_color_enable]',
  110.     array(
  111.         'default' => false,
  112.         'capability'     => 'edit_theme_options',
  113.         'sanitize_callback' => 'sanitize_text_field',
  114.         'type' => 'option',
  115.     )  
  116.     );
  117.     $wp_customize->add_control(
  118.     'quality_pro_options[link_color_enable]',
  119.     array(
  120.         'label' => __('Skin Color Enable','quality'),
  121.         'section' => 'header_image',
  122.         'type' => 'checkbox',
  123.     )
  124.     );
  125.    
  126.    
  127.     $wp_customize->add_setting(
  128.     'quality_pro_options[link_color]', array(
  129.     'capability'     => 'edit_theme_options',
  130.     'default' => '#f8504b',
  131.     'type' => 'option',
  132.     ));
  133.    
  134.     $wp_customize->add_control(
  135.     new WP_Customize_Color_Control(
  136.     $wp_customize,
  137.     'quality_pro_options[link_color]',
  138.     array(
  139.         'label'      => __( 'Skin Color', 'quality' ),
  140.         'section'    => 'header_image',
  141.         'settings'   => 'quality_pro_options[link_color]',
  142.     ) ) );
  143.    
  144.    
  145.     $wp_customize->add_setting(
  146.     'quality_pro_options[layout_selector]', array(
  147.         'default'        => 'wide',
  148.         'capability'     => 'edit_theme_options',
  149.         'sanitize_callback' => 'sanitize_text_field',
  150.         'type' => 'option',
  151.     ));
  152.     $wp_customize->add_control('quality_pro_options[layout_selector]', array(
  153.         'label'   => __('Theme Layout :', 'quality'),
  154.         'section' => 'header_image',
  155.         'priority'   => 150,
  156.         'type' => 'select',
  157.         'choices' => array('wide' => 'wide','boxed' => 'boxed'),
  158.     ));
  159.    
  160.     $wp_customize->add_setting(
  161.     'quality_pro_options[back_image]', array(
  162.     'default' => 'bg-img0.png',  
  163.     'capability'     => 'edit_theme_options',
  164.     'sanitize_callback' => 'sanitize_text_field',
  165.     'type' => 'option',
  166.     ));
  167.     $wp_customize->add_control(new WP_back_Customize_Control($wp_customize,'quality_pro_options[back_image]',
  168.     array(
  169.         'label'   => __('Predefined Default Background', 'quality'),
  170.         'section' => 'header_image',
  171.         'priority'   => 160,
  172.         'type' => 'radio',
  173.         'choices' => array(
  174.             'bg-img0.png' => 'Pattern 0',
  175.             'bg_img1.png' => 'Pattern 1',
  176.             'bg_img2.png' => 'Pattern 2',
  177.             'bg_img3.png' => 'Pattern 3',
  178.             'bg_img4.png' => 'Pattern 4',
  179.             'bg_img5.png' => 'Pattern 5',
  180.             'bg_img6.png' => 'Pattern 6',
  181.             'bg_img7.png' => 'Pattern 7',
  182.     )
  183.    
  184.     )));
  185.    
  186.    
  187.     /* favicon option */
  188.     $wp_customize->add_section( 'quality_favicon' , array(
  189.       'title'       => __( 'Site favicon', 'quality' ),
  190.       'priority'    => 300,
  191.       'description' => __( 'Upload a favicon', 'quality' ),
  192.       'panel'  => 'header_options',
  193.     ) );
  194.    
  195.     $wp_customize->add_setting('quality_pro_options[upload_image_favicon]', array(
  196.       'sanitize_callback' => 'esc_url_raw',
  197.        'capability'     => 'edit_theme_options',
  198.        'type' => 'option',
  199.     ) );
  200.    
  201.     $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'quality_pro_options[upload_image_favicon]', array(
  202.       'label'    => __( 'Choose your favicon (ideal width and height is 16x16 or 32x32)', 'quality' ),
  203.       'section'  => 'quality_favicon',
  204.     ) ) );
  205.    
  206.    
  207.    
  208.     //Header social Icon
  209.  
  210.     $wp_customize->add_section(
  211.         'header_social_icon',
  212.         array(
  213.             'title' => 'Social Link ',
  214.            'priority'    => 400,
  215.             'panel' => 'header_options',
  216.         )
  217.     );
  218.    
  219.     //Show and hide Header Social Icons
  220.     $wp_customize->add_setting(
  221.     'quality_pro_options[header_social_media_enabled]'
  222.     ,
  223.     array(
  224.         'default' => true,
  225.         'capability'     => 'edit_theme_options',
  226.         'sanitize_callback' => 'sanitize_text_field',
  227.         'type' => 'option',
  228.     )  
  229.     );
  230.     $wp_customize->add_control(
  231.     'quality_pro_options[header_social_media_enabled]',
  232.     array(
  233.         'label' => __('Hide Social icons','quality'),
  234.         'section' => 'header_social_icon',
  235.         'type' => 'checkbox',
  236.     )
  237.     );
  238.  
  239.     // Facebook link
  240.     $wp_customize->add_setting(
  241.     'quality_pro_options[social_media_facebook_link]',
  242.     array(
  243.         'default' => '#',
  244.         'sanitize_callback' => 'sanitize_text_field',
  245.         'type' => 'option',
  246.     )
  247.    
  248.     );
  249.     $wp_customize->add_control(
  250.     'quality_pro_options[social_media_facebook_link]',
  251.     array(
  252.         'label' => __('Facebook Links:','quality'),
  253.         'section' => 'header_social_icon',
  254.         'type' => 'text',
  255.     )
  256.     );
  257.  
  258.     //twitter link
  259.    
  260.     $wp_customize->add_setting(
  261.     'quality_pro_options[social_media_twitter_link]',
  262.     array(
  263.         'default' => '#',
  264.         'type' => 'theme_mod',
  265.         'sanitize_callback' => 'sanitize_text_field',
  266.         'type' => 'option',
  267.     )
  268.    
  269.     );
  270.     $wp_customize->add_control(
  271.     'quality_pro_options[social_media_twitter_link]',
  272.     array(
  273.         'label' => __('Twitter Link:','quality'),
  274.         'section' => 'header_social_icon',
  275.         'type' => 'text',
  276.     )
  277.     );
  278.  
  279.    
  280.     //Linkdin link
  281.    
  282.     $wp_customize->add_setting(
  283.     'quality_pro_options[social_media_linkedin_link]' ,
  284.     array(
  285.         'default' => '#',
  286.         'sanitize_callback' => 'sanitize_text_field',
  287.         'type' => 'option',
  288.     )
  289.    
  290.     );
  291.     $wp_customize->add_control(
  292.     'quality_pro_options[social_media_linkedin_link]',
  293.     array(
  294.         'label' => __('snapchat Links:','quality'),
  295.         'section' => 'header_social_icon',
  296.         'type' => 'text',
  297.     )
  298.     );
  299.    
  300.     //Google plus
  301.    
  302.     $wp_customize->add_setting(
  303.     'quality_pro_options[social_media_google_plus]' ,
  304.     array(
  305.         'default' => '#',
  306.         'sanitize_callback' => 'sanitize_text_field',
  307.         'type' => 'option',
  308.     )
  309.    
  310.     );
  311.     $wp_customize->add_control(
  312.     'quality_pro_options[social_media_google_plus]',
  313.     array(
  314.         'label' => __('Instagram Links:','quality'),
  315.         'section' => 'header_social_icon',
  316.         'type' => 'text',
  317.     )
  318.     );
  319.    
  320.     //youtub
  321.    
  322.     $wp_customize->add_setting(
  323.     'quality_pro_options[social_youtub]' ,
  324.     array(
  325.         'default' => '#',
  326.         'sanitize_callback' => 'sanitize_text_field',
  327.         'type' => 'option',
  328.     )
  329.    
  330.     );
  331.     $wp_customize->add_control(
  332.     'quality_pro_options[social_youtub]',
  333.     array(
  334.         'label' => __('Youtub Links:','quality'),
  335.         'section' => 'header_social_icon',
  336.         'type' => 'text',
  337.     )
  338.     );
  339.    
  340.    
  341.  
  342.  
  343.    
  344.    
  345.     //Header logo setting
  346.     $wp_customize->add_section( 'header_logo' , array(
  347.         'title'      => __('Header Logo setting', 'quality'),
  348.         'panel'  => 'header_options',
  349.         'priority'   => 400,
  350.     ) );
  351.     $wp_customize->add_setting(
  352.         'quality_pro_options[upload_image_logo]'
  353.         , array(
  354.         'default'        => '',
  355.         'capability'     => 'edit_theme_options',
  356.         'sanitize_callback' => 'esc_url_raw',
  357.         'type' => 'option',
  358.     ));
  359.    
  360.     $wp_customize->add_control(
  361.            new WP_Customize_Image_Control(
  362.                $wp_customize,
  363.                'quality_pro_options[upload_image_logo]',
  364.                array(
  365.                    'label'          => __( 'Upload a 150x150 for Logo Image', 'quality' ),
  366.                    'section'        => 'header_logo',
  367.                    'priority'   => 50,
  368.                )
  369.            )
  370.     );
  371.    
  372.     //Enable/Disable logo text
  373.     $wp_customize->add_setting(
  374.     'quality_pro_options[text_title]',array(
  375.     'default'    => true,
  376.     'sanitize_callback' => 'sanitize_text_field',
  377.     'type' => 'option'
  378.     ));
  379.  
  380.     $wp_customize->add_control(
  381.     'quality_pro_options[text_title]',
  382.     array(
  383.         'type' => 'checkbox',
  384.         'label' => __('Enable/Disabe Logo','quality'),
  385.         'section' => 'header_logo',
  386.         'priority'   => 100,
  387.     )
  388.     );
  389.    
  390.    
  391.     //Logo width
  392.    
  393.     $wp_customize->add_setting(
  394.     'quality_pro_options[width]',array(
  395.     'sanitize_callback' => 'sanitize_text_field',
  396.     'default' => 200,
  397.     'type' => 'option',
  398.    
  399.     ));
  400.  
  401.     $wp_customize->add_control(
  402.     'quality_pro_options[width]',
  403.     array(
  404.         'type' => 'text',
  405.         'label' => __('Enter Logo Width','quality'),
  406.         'section' => 'header_logo',
  407.         'priority'   => 400,
  408.     )
  409.     );
  410.    
  411.     //Logo Height
  412.     $wp_customize->add_setting(
  413.     'quality_pro_options[height]',array(
  414.     'sanitize_callback' => 'sanitize_text_field',
  415.     'default' => 80,
  416.     'type'=>'option',
  417.    
  418.     ));
  419.  
  420.     $wp_customize->add_control(
  421.     'quality_pro_options[height]',
  422.     array(
  423.         'type' => 'text',
  424.         'label' => __('Enter Logo Height','quality'),
  425.         'section' => 'header_logo',
  426.         'priority'   =>410,
  427.     )
  428.     );
  429.    
  430.    
  431.    
  432.     //Text logo
  433.     $wp_customize->add_setting(
  434.     'quality_pro_options[text_title]'
  435.     ,array(
  436.     'default' => true,
  437.     'sanitize_callback' => 'sanitize_text_field',
  438.     'type' =>'option',
  439.    
  440.     ));
  441.  
  442.     $wp_customize->add_control(
  443.     'quality_pro_options[text_title]',
  444.     array(
  445.         'type' => 'checkbox',
  446.         'label' => __('Show Logo text','quality'),
  447.         'section' => 'header_logo',
  448.         'priority'   => 200,
  449.     )
  450.     );
  451.    
  452.     //Custom css
  453.     $wp_customize->add_section( 'custom_css' , array(
  454.         'title'      => __('Custom css', 'quality'),
  455.         'panel'  => 'header_options',
  456.         'priority'   => 100,
  457.     ) );
  458.     $wp_customize->add_setting(
  459.     'quality_pro_options[webrit_custom_css]'
  460.         , array(
  461.         'default'        => '',
  462.         'capability'     => 'edit_theme_options',
  463.         'sanitize_callback' => 'sanitize_text_field',
  464.         'type'=> 'option',
  465.     ));
  466.     $wp_customize->add_control( 'quality_pro_options[webrit_custom_css]', array(
  467.         'label'   => __('Custom css snippet:', 'quality'),
  468.         'section' => 'custom_css',
  469.         'type' => 'textarea',
  470.         'priority'   => 100,
  471.     ));    
  472.     }
  473.     add_action( 'customize_register', 'quality_header_customizer' );
  474.     ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top