remove_control() публичный Метод

Remove a customize control.
С версии: 3.4.0
public remove_control ( string $id )
$id string ID of the control.
Пример #1
1
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function tesseract_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    $wp_customize->add_panel('tesseract_general_options', array('priority' => 3, 'capability' => 'edit_theme_options', 'title' => 'General'));
    $wp_customize->add_panel('tesseract_header_options', array('priority' => 4, 'capability' => 'edit_theme_options', 'title' => 'Header Options'));
    $wp_customize->add_panel('tesseract_footer_options', array('priority' => 5, 'capability' => 'edit_theme_options', 'title' => 'Footer Options'));
    $wp_customize->add_panel('tesseract_layout', array('priority' => 7, 'capability' => 'edit_theme_options', 'title' => 'Layout Options'));
    $wp_customize->add_panel('tesseract_social', array('priority' => 8, 'capability' => 'edit_theme_options', 'title' => 'Social'));
    $wp_customize->get_section('title_tagline')->panel = 'tesseract_header_options';
    $wp_customize->get_section('title_tagline')->priority = 3;
    if ($wp_customize->get_section('static_front_page')) {
        $wp_customize->get_section('static_front_page')->panel = 'tesseract_general_options';
        $wp_customize->get_section('static_front_page')->priority = 4;
    }
    $wp_customize->get_section('background_image')->panel = 'tesseract_general_options';
    $wp_customize->get_section('background_image')->priority = 2;
    $wp_customize->get_section('colors')->panel = 'tesseract_general_options';
    $wp_customize->get_section('colors')->title = __('Background Color', 'tesseract');
    $wp_customize->get_section('colors')->priority = 1;
    $wp_customize->get_control('background_color')->label = __('Choose a background color', 'tesseract');
    $wp_customize->get_control('background_color')->description = __('(This is only for the site\'s generic background color. You can define header and footer background colors in the Header Options and Footer Options respectively.)', 'tesseract');
    $wp_customize->remove_section('header_image');
    $wp_customize->remove_section('nav');
    $wp_customize->remove_control('header_textcolor');
    require get_template_directory() . '/inc/sections/header-colors.php';
    require get_template_directory() . '/inc/sections/header-logo.php';
    require get_template_directory() . '/inc/sections/header-size.php';
    require get_template_directory() . '/inc/sections/header-menu.php';
    require get_template_directory() . '/inc/sections/header-content.php';
    require get_template_directory() . '/inc/sections/mobile-menu.php';
    require get_template_directory() . '/inc/sections/social/account01.php';
    require get_template_directory() . '/inc/sections/social/account02.php';
    require get_template_directory() . '/inc/sections/social/account03.php';
    require get_template_directory() . '/inc/sections/social/account04.php';
    require get_template_directory() . '/inc/sections/social/account05.php';
    require get_template_directory() . '/inc/sections/social/account06.php';
    require get_template_directory() . '/inc/sections/social/account07.php';
    require get_template_directory() . '/inc/sections/social/account08.php';
    require get_template_directory() . '/inc/sections/social/account09.php';
    require get_template_directory() . '/inc/sections/social/account10.php';
    require get_template_directory() . '/inc/sections/blog.php';
    require get_template_directory() . '/inc/sections/search-results.php';
    require get_template_directory() . '/inc/sections/footer-colors.php';
    require get_template_directory() . '/inc/sections/footer-size.php';
    require get_template_directory() . '/inc/sections/footer-logo.php';
    require get_template_directory() . '/inc/sections/footer-content.php';
    require get_template_directory() . '/inc/sections/woocommerce.php';
    //if ( $wp_customize->is_preview() && ! is_admin() )
    //add_action( 'wp_footer', 'tesseract_customize_preview', 21);
}
Пример #2
0
 /**
  * This hooks into 'customize_register' (available as of WP 3.4) and allows
  * you to add new sections and controls to the Theme Customize screen.
  *
  * Note: To enable instant preview, we have to actually write a bit of custom
  * javascript. See live_preview() for more.
  *
  * @see add_action('customize_register',$func)
  * @param \WP_Customize_Manager $wp_customize
  * @since Supernova 1.0
  */
 public static function register($wp_customize)
 {
     //4. We can also change built-in settings by modifying properties. For instance, let's make some stuff use live preview JS...
     $wp_customize->get_setting('blogname')->transport = 'postMessage';
     $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
     $wp_customize->remove_control('display_header_text');
     $wp_customize->remove_control('background_color');
     $wp_customize->remove_control('header_image');
     $wp_customize->remove_control('header_textcolor');
 }
Пример #3
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function goran_customize_register($wp_customize)
{
    $wp_customize->remove_setting('edin_menu_style');
    $wp_customize->remove_control('edin_menu_style');
    $wp_customize->remove_setting('edin_featured_image_remove_filter');
    $wp_customize->remove_control('edin_featured_image_remove_filter');
    $wp_customize->remove_setting('edin_search_header');
    $wp_customize->remove_control('edin_search_header');
    /* Top Area Content */
    $wp_customize->add_setting('goran_top_area_content', array('default' => '', 'sanitize_callback' => 'wp_kses_post'));
    $wp_customize->add_control('goran_top_area_content', array('label' => __('Top Area Content', 'sequential'), 'section' => 'edin_theme_options', 'priority' => 3, 'type' => 'textarea'));
}
Пример #4
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function landing_customize_register($wp_customize)
{
    $wp_customize->remove_section('static_front_page');
    $wp_customize->remove_section('title_tagline');
    $wp_customize->remove_control('blogdescription');
    $wp_customize->remove_control('display_header_text');
    $wp_customize->add_section('title_tagline', array('title' => __('Site Title & User Info', 'landing'), 'priority' => 20));
    $wp_customize->add_setting('username', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => 'EL Maxo', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_text_field($str);
    }));
    $wp_customize->add_setting('userskills', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => 'web developer', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_text_field($str);
    }));
    $wp_customize->add_setting('telephone', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => '+9999999999', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_text_field($str);
    }));
    $wp_customize->add_setting('address', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => 'Lorem Ipsum - это текст-"рыба", часто используемый в печати и вэб-дизайне.', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_text_field($str);
    }));
    $wp_customize->add_setting('email', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => '*****@*****.**', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_email($str);
    }));
    $wp_customize->add_setting('birthday', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => '1988-04-03', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_email($str);
    }));
    $wp_customize->add_setting('site', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => 'webdesign-master.ru', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return sanitize_text_field($str);
    }));
    $wp_customize->add_setting('prof_description', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'default' => 'Проффестональное создание сайтов: разработка дизайна, верстка, посадка на CMS WOrdPress', 'transport' => 'postMessage', 'sanitize_callback' => function ($str) {
        return implode("\n", array_map('sanitize_text_field', explode("\n", $str)));
    }));
    $wp_customize->add_control('username', array('type' => 'text', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your name', 'landing')));
    $wp_customize->add_control('userskills', array('type' => 'text', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your speciality', 'landing')));
    $wp_customize->add_control('telephone', array('type' => 'text', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your telephone', 'landing')));
    $wp_customize->add_control('address', array('type' => 'textarea', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your address', 'landing')));
    $wp_customize->add_control('email', array('type' => 'text', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your email', 'landing')));
    $wp_customize->add_control('birthday', array('type' => 'date', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your birth day', 'landing')));
    $wp_customize->add_control('site', array('type' => 'text', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your site (without http://)', 'landing')));
    $wp_customize->add_control('prof_description', array('type' => 'textarea', 'priority' => 10, 'section' => 'title_tagline', 'label' => __('Your Professional Description', 'landing')));
    $wp_customize->add_section('logo', array('title' => __('Logo', 'landing'), 'description' => __('Select Your Logo', 'landing'), 'priority' => 90));
    $wp_customize->add_setting('logo', array('type' => 'theme_mod', 'default' => get_template_directory_uri() . '/img/logo.svg', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array('label' => __('Featured Logo', 'landing'), 'section' => 'logo', 'settings' => 'logo', 'mime_type' => 'image')));
    $wp_customize->add_section('photo', array('title' => __('Photo', 'landing'), 'description' => __('Select Your Photo', 'landing'), 'priority' => 90));
    $wp_customize->add_setting('photo', array('type' => 'theme_mod', 'default' => get_template_directory_uri() . '/img/photo.jpg', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'photo', array('label' => __('Your Photo', 'landing'), 'section' => 'photo', 'settings' => 'photo')));
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
}
 /**
  * Temporarily remove widget settings and controls from the Manager so that
  * they won't be serialized at once in _wpCustomizeSettings. This greatly
  * reduces the peak memory usage.
  *
  * This is only relevant in WordPress versions older than 4.4-alpha-33636-src,
  * with the changes introduced in Trac #33898.
  *
  * @link https://core.trac.wordpress.org/ticket/33898
  */
 function defer_serializing_data_until_shutdown()
 {
     $this->customize_controls = array();
     $controls = $this->manager->controls();
     foreach ($controls as $control) {
         if ($control instanceof \WP_Widget_Form_Customize_Control || $control instanceof \WP_Widget_Area_Customize_Control) {
             $this->customize_controls[$control->id] = $control;
             $this->manager->remove_control($control->id);
         }
     }
     /*
      * Note: There is currently a Core dependency issue where the control for WP_Widget_Area_Customize_Control
      * must be processed after the control for WP_Widget_Form_Customize_Control, as otherwise the sidebar
      * does not initialize properly (specifically in regards to the reorder-toggle button. So this is why
      * we are including the WP_Widget_Area_Customize_Controls among those which are deferred.
      */
     $this->customize_settings = array();
     $settings = $this->manager->settings();
     foreach ($settings as $setting) {
         if (preg_match('/^(widget_.+?\\[\\d+\\]|sidebars_widgets\\[.+?\\])$/', $setting->id)) {
             $this->customize_settings[$setting->id] = $setting;
             $this->manager->remove_setting($setting->id);
         }
     }
     // We have to use shutdown because no action is triggered after _wpCustomizeSettings is written.
     add_action('shutdown', array($this, 'export_data_with_peak_memory_usage_minimized'), 10);
     add_action('shutdown', array($this, 'fixup_widget_control_params_for_dom_deferral'), 11);
 }
Пример #6
0
/**
 * @param WP_Customize_Manager $wp_customize Customizer object.
 */
function wplook_customize_register($wp_customize)
{
    /*------------------------------------------------------------
    		Add Colors options
    	============================================================*/
    /*------------------------------------------------------------
    		Add custom toolbar Color.
    	============================================================*/
    $wp_customize->add_setting('wplook_toolbar_color', array('default' => '#232323', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wplook_toolbar_color', array('label' => __('Toolbar Color', 'charity-life-wpl'), 'description' => __('Background color for Toolbar', 'charity-life-wpl'), 'section' => 'colors')));
    /*------------------------------------------------------------
    		Add Footer Color
    	============================================================*/
    $wp_customize->add_setting('wplook_footer_color', array('default' => '#232323', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wplook_footer_color', array('label' => __('Footer  background color', 'charity-life-wpl'), 'description' => __('Background color for Footer', 'charity-life-wpl'), 'section' => 'colors')));
    /*------------------------------------------------------------
    		Add Footer Widget Color
    	============================================================*/
    $wp_customize->add_setting('wplook_footer_widget_color', array('default' => '#262626', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wplook_footer_widget_color', array('label' => __('Footer Widget background color', 'charity-life-wpl'), 'description' => __('Background color for Widget Footer', 'charity-life-wpl'), 'section' => 'colors')));
    /*------------------------------------------------------------
    		Add Accent Color
    	============================================================*/
    $wp_customize->add_setting('wplook_accent_color', array('default' => '#b54e2d', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wplook_accent_color', array('label' => __('Accent Color', 'charity-life-wpl'), 'description' => __('Chose the Accent Color', 'charity-life-wpl'), 'section' => 'colors')));
    /*------------------------------------------------------------
    		Add Accent Color 2
    	============================================================*/
    $wp_customize->add_setting('wplook_accent2_color', array('default' => '#468966', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'wplook_accent2_color', array('label' => __('Accent 2 Color', 'charity-life-wpl'), 'description' => __('Chose the Accent 2 Color', 'charity-life-wpl'), 'section' => 'colors')));
    $wp_customize->remove_control('header_textcolor');
}
Пример #7
0
/**
 * Add postMessage support for site title and description for the Customizer.
 *
 * @since Kute Theme 1.0
 *
 * @param WP_Customize_Manager $wp_customize Customizer object.
 */
function kt_customize_register($wp_customize)
{
    $color_scheme = kt_get_color_scheme();
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    // Add color scheme setting and control.
    $wp_customize->add_setting('color_scheme', array('default' => 'default', 'sanitize_callback' => 'kt_sanitize_color_scheme', 'transport' => 'postMessage'));
    $wp_customize->add_control('color_scheme', array('label' => esc_attr__('Base Color Scheme', 'kutetheme'), 'section' => 'colors', 'type' => 'select', 'choices' => kt_get_color_scheme_choices(), 'priority' => 1));
    // Add custom header and sidebar text color setting and control.
    $wp_customize->add_setting('main_color', array('default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'main_color', array('label' => esc_attr__('Theme Color', 'kutetheme'), 'description' => esc_attr__('Applied to the theme color.', 'kutetheme'), 'section' => 'colors')));
    // Remove the core header textcolor control, as it shares the sidebar text color.
    $wp_customize->remove_control('header_textcolor');
    // Add custom header and sidebar background color setting and control.
    $wp_customize->add_setting('box_background_color', array('default' => $color_scheme[2], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'box_background_color', array('label' => esc_attr__('Box and Sidebar Background Color', 'kutetheme'), 'description' => esc_attr__('Applied to the box and sidebar color.', 'kutetheme'), 'section' => 'colors')));
    // Add custom header and sidebar background color setting and control.
    $wp_customize->add_setting('textcolor', array('default' => $color_scheme[3], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'textcolor', array('label' => esc_attr__('Text Color', 'kutetheme'), 'description' => esc_attr__('Applied to the text color', 'kutetheme'), 'section' => 'colors')));
    // Add custom header and sidebar background color setting and control.
    $wp_customize->add_setting('price_color', array('default' => $color_scheme[8], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'price_color', array('label' => esc_attr__('Price Color', 'kutetheme'), 'description' => esc_attr__('Applied to the price on wide screens.', 'kutetheme'), 'section' => 'colors')));
    // Add an additional description to the header image section.
    $wp_customize->get_section('header_image')->description = esc_attr__('Applied to the header on small screens and the sidebar on wide screens.', 'kutetheme');
}
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function great_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    // Remove unused site description (tagline).
    $wp_customize->remove_control('blogdescription');
}
 /**
  * Handle a control entry
  *
  * @param $id
  * @param $section_id
  * @param array $data
  * @throws \ErrorException If the `control_class` can not be found
  */
 public function setControl($id, $section_id, array $data)
 {
     $control_data = $this->getControlData($id, $section_id, $data);
     if (is_null($section_id) && isset($data['section'])) {
         $section_id = $data['section'];
     }
     $item = $this->customizer->get_control($id);
     if ($item) {
         foreach ($data as $var => $val) {
             if (array_key_exists($var, $control_data)) {
                 $item->{$var} = $val;
             } elseif ($var == 'control_type') {
                 $item->type = $val;
             }
         }
         if (!is_null($section_id)) {
             $item->section = $section_id;
         }
         if (isset($data['delete']) && $data['delete'] === true) {
             $this->customizer->remove_control($id);
         }
     } else {
         if (!isset($data['control_type'])) {
             $data['control_type'] = 'text';
         }
         $cls = isset($data['control_class']) ? $data['control_class'] : null;
         if (is_null($cls)) {
             switch ($data['control_type']) {
                 case 'select':
                     $cls = 'WP_Customize_Control';
                     foreach ($data['choices'] as $var => $val) {
                         $data['choices'][$var] = __($val, 'basicbootstrap');
                     }
                     break;
                 case 'checkbox':
                     $cls = 'WP_Customize_Control';
                     if (!isset($data['sanitize_callback'])) {
                         $data['sanitize_callback'] = 'sanitize_checkbox';
                     }
                     break;
                 case 'color':
                     $cls = 'WP_Customize_Color_Control';
                     if (!isset($data['sanitize_callback'])) {
                         $data['sanitize_callback'] = 'sanitize_hex_color';
                     }
                     break;
                 default:
                     $cls = 'WP_Customize_Control';
                     break;
             }
         }
         if (!class_exists($cls)) {
             throw new ErrorException(sprintf('Customizer control class "%s" not found!', $cls));
         }
         $this->customizer->add_control(new $cls($this->customizer, $id, $control_data));
     }
 }
Пример #10
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function meg_n_boots_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    /**
     * Additional Customizer Options and changes
     */
    //Customize Title Section
    $wp_customize->get_section('title_tagline')->title = __('Site Title, Tagline, & Icon', 'meg_n_boots');
    //Hero Image and Title Section
    $wp_customize->add_section('meg_n_boots_hero_title', array('title' => __('Hero Image and Title', 'meg-n-boots'), 'priority' => 61));
    $wp_customize->add_setting('meg_n_boots_hero_title', array('default' => 'A nice, bold title!', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('meg_n_boots_hero_title', array('label' => __('Hero Title', 'meg-n-boots'), 'description' => __('This is the text you want overlayed on your front page Hero Image.', 'meg-n-boots'), 'section' => 'meg_n_boots_hero_title', 'type' => 'text', 'priority' => 1));
    $wp_customize->add_setting('meg_n_boots_hero_subtitle', array('default' => 'And a smalled, supporting subtitle to go with it.', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('meg_n_boots_hero_subtitle', array('label' => __('Hero Subtitle', 'meg-n-boots'), 'description' => __('This is the subtitle text you want overlayed on your front page Hero Image.', 'meg-n-boots'), 'section' => 'meg_n_boots_hero_title', 'type' => 'text', 'priority' => 2));
    $wp_customize->add_setting('meg_n_boots_hero_image', array('default' => '../img/boots-mtn.jpg', 'sanitize_callback' => 'esc_url'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'meg_n_boots_hero_image', array('label' => __('Hero Image', 'meg-n-boots'), 'description' => __('This is the hero image you want displayed, should be at the dimensions 2000 x 745 pixels, or proportionally larger. best results are with images 2000px or wider.', 'meg-n-boots'), 'section' => 'meg_n_boots_hero_title', 'settings' => 'meg_n_boots_hero_image', 'priority' => 20)));
    //End Hero Image and Title Section
    //	Add Color Options for Theme
    //	remove default color areas
    $wp_customize->remove_control('header_textcolor');
    $wp_customize->remove_control('background_color');
    $wp_customize->add_setting('site_primary_color', array('default' => '#d43f3a', 'sanitize_callback' => 'sanitize_hex_color'));
    // add color picker control
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'site_primary_color', array('label' => 'Site Primary Color', 'section' => 'colors', 'settings' => 'site_primary_color', 'priority' => 1)));
    $wp_customize->add_setting('title_text_color', array('default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color'));
    // add color picker control
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'title_text_color', array('label' => 'Title Text Color', 'section' => 'colors', 'settings' => 'title_text_color', 'priority' => 2)));
    $wp_customize->add_setting('body_color', array('default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color'));
    // add color picker control
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'body_color', array('label' => 'Body Color', 'section' => 'colors', 'settings' => 'body_color', 'priority' => 11)));
    $wp_customize->add_setting('text_color', array('default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color'));
    // add color picker control
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'text_color', array('label' => 'Text Color', 'section' => 'colors', 'settings' => 'text_color', 'priority' => 12)));
    $wp_customize->add_setting('link_color', array('default' => '#337ab7', 'sanitize_callback' => 'sanitize_hex_color'));
    // add color picker control
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => 'Link Color', 'section' => 'colors', 'settings' => 'link_color', 'priority' => 15)));
    $wp_customize->add_setting('background_theme_color', array('default' => '#e9e9e9', 'sanitize_callback' => 'sanitize_hex_color'));
    // add color picker control
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'background_theme_color', array('label' => 'Background Theme Color', 'section' => 'colors', 'settings' => 'background_theme_color', 'priority' => 20)));
    //	Add Color Options for Theme
}
Пример #11
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function temptation_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->remove_control('header_textcolor');
    $wp_customize->add_setting('temptation_title_color', array('default' => '#a7a7a7'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'temptation_title_color', array('label' => __('Site Title Color', 'temptation'), 'section' => 'colors', 'settings' => 'temptation_title_color', 'priority' => 102)));
    $wp_customize->add_setting('temptation_desc_color', array('default' => '#ff8a00'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'temptation_desc_color', array('label' => __('Site Description Color', 'temptation'), 'section' => 'colors', 'settings' => 'temptation_desc_color', 'priority' => 102)));
}
Пример #12
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function wgiinformer_customize_register($wp_customize)
{
    $sections_to_remove = array("colors", "header_image", "background_image");
    foreach ($sections_to_remove as $str) {
        $wp_customize->remove_section($str);
    }
    $controls_to_remove = array("blogdescription", "display_header_text");
    foreach ($controls_to_remove as $ctr) {
        $wp_customize->remove_control($ctr);
    }
}
Пример #13
0
/**
 * Adding different options
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function supermag_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    /*saved options*/
    $options = supermag_get_theme_options();
    /*defaults options*/
    $defaults = supermag_get_default_theme_options();
    /*
     * file for customizer custom controls classes
     */
    $supermag_custom_controls_file_path = supermag_file_directory('acmethemes/customizer/custom-controls.php');
    require $supermag_custom_controls_file_path;
    /*
     * file for feature panel of home page
     */
    $supermag_customizer_feature_option_file_path = supermag_file_directory('acmethemes/customizer/feature-section/feature-panel.php');
    require $supermag_customizer_feature_option_file_path;
    /*
     * file for header panel
     */
    $supermag_customizer_header_options_file_path = supermag_file_directory('acmethemes/customizer/header-options/header-panel.php');
    require $supermag_customizer_header_options_file_path;
    /*
     * file for customizer footer section
     */
    $supermag_customizer_footer_options_file_path = supermag_file_directory('acmethemes/customizer/footer-section/footer-section.php');
    require $supermag_customizer_footer_options_file_path;
    /*
     * file for design/layout panel
     */
    $supermag_customizer_design_options_file_path = supermag_file_directory('acmethemes/customizer/design-options/design-panel.php');
    require $supermag_customizer_design_options_file_path;
    /*
     * file for single post sections
     */
    $supermag_customizer_single_post_section_file_path = supermag_file_directory('acmethemes/customizer/single-posts/single-post-section.php');
    require $supermag_customizer_single_post_section_file_path;
    /*
     * file for options panel
     */
    $supermag_customizer_options_panel_file_path = supermag_file_directory('acmethemes/customizer/options/options-panel.php');
    require $supermag_customizer_options_panel_file_path;
    /*
     * file for options reset
     */
    $supermag_customizer_options_reset_file_path = supermag_file_directory('acmethemes/customizer/options/options-reset.php');
    require $supermag_customizer_options_reset_file_path;
    /*removing*/
    $wp_customize->remove_panel('header_image');
    $wp_customize->remove_control('header_textcolor');
}
Пример #14
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function fifteen_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    $wp_customize->remove_control('header_textcolor');
    $wp_customize->add_setting('fifteen_title_color', array('default' => '#22233A', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'fifteen_title_color', array('label' => __('Site Title Color', 'fifteen'), 'section' => 'colors', 'settings' => 'fifteen_title_color', 'priority' => 102)));
    $wp_customize->add_setting('fifteen_desc_color', array('default' => '#ffffff', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'fifteen_desc_color', array('label' => __('Site Description Color', 'fifteen'), 'section' => 'colors', 'settings' => 'fifteen_desc_color', 'priority' => 102)));
    $wp_customize->add_setting('fifteen_menu_color', array('default' => '#ffffff', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'fifteen_menu_color', array('label' => __('Primary Menu Color', 'fifteen'), 'section' => 'colors', 'settings' => 'fifteen_menu_color', 'priority' => 106)));
}
Пример #15
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function hooch_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    $wp_customize->remove_control('blogdescription');
    $wp_customize->remove_control("header_textcolor");
    $wp_customize->remove_control("header_image");
    /**
     * Add site logo to Site Identity
     *
     */
    $wp_customize->add_setting('site_logo', array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'hooch_sanitize_image'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'site_logo', array('settings' => 'site_logo', 'section' => 'title_tagline', 'label' => __('Site Logo', 'hooch'), 'description' => __('Select the image to be used for the site logo.', 'hooch'))));
    /**
     * Add footer section
     *
     */
    $wp_customize->add_section('hooch_section_footer', array('title' => __('Footer Options', 'hooch'), 'description' => __('Options for the Footer', 'hooch')));
    $wp_customize->add_setting('footer_copyright_text', array('default' => sprintf(__('Theme: %1$s by %2$s.', 'hooch'), 'Hooch', '<a href="http://braginteractive.com" rel="designer">Brad Williams</a>'), 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'hooch_sanitize_html'));
    $wp_customize->add_control('footer_copyright_text', array('settings' => 'footer_copyright_text', 'section' => 'hooch_section_footer', 'type' => 'text', 'label' => __('Footer Copyright Text', 'hooch'), 'description' => __('Copyright or other text to be displayed in the site footer. HTML allowed.', 'hooch')));
}
Пример #16
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function goran_customize_register($wp_customize)
{
    $wp_customize->remove_setting('edin_menu_style');
    $wp_customize->remove_control('edin_menu_style');
    $wp_customize->remove_setting('edin_featured_image_remove_filter');
    $wp_customize->remove_control('edin_featured_image_remove_filter');
    $wp_customize->remove_setting('edin_search_header');
    $wp_customize->remove_control('edin_search_header');
    $wp_customize->get_setting('site_logo')->transport = 'refresh';
    /* Adds textarea support to the theme customizer */
    class Goran_WP_Customize_Control_Textarea extends WP_Customize_Control
    {
        public $type = 'textarea';
        public function render_content()
        {
            ?>
	        	<label>
	                <span class="customize-control-title"><?php 
            echo esc_html($this->label);
            ?>
</span>
	                <textarea cols="20" rows="5" style="width:100%;" <?php 
            $this->link();
            ?>
><?php 
            echo esc_textarea($this->value());
            ?>
</textarea>
	            </label>
	        <?php 
        }
    }
    /* Top Area Content */
    $wp_customize->add_setting('goran_top_area_content', array('default' => '', 'sanitize_callback' => 'wp_kses_post'));
    $wp_customize->add_control(new Goran_WP_Customize_Control_Textarea($wp_customize, 'goran_top_area_content', array('label' => __('Top Area Content', 'goran'), 'section' => 'edin_theme_options', 'priority' => 3, 'type' => 'textarea')));
}
Пример #17
0
 /**
  * This hooks into 'customize_register' (available as of WP 3.4) and allows
  * you to add new sections and controls to the Theme Customize screen.
  *
  * Note: To enable instant preview, we have to actually write a bit of custom
  * javascript. See live_preview() for more.
  *
  * @see add_action('customize_register',$func)
  * @param \WP_Customize_Manager $wp_customize
  * @since blank-theme 1.0
  */
 public static function register($wp_customize)
 {
     /*==============================
             Site title & Tagline
       ===============================*/
     //Logo
     $wp_customize->add_setting('blank_theme_logo', array('default' => "", 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'blank_theme_logo', array('label' => __('Choose Site Logo', 'blank-theme'), 'section' => 'title_tagline', 'settings' => 'blank_theme_logo', 'description' => __('Remove logo to display site title.', 'blank-theme'))));
     //Hide tagline
     $wp_customize->add_setting('blank_theme_hide_tagline', array('default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'blank_theme_sanitize_checkboxes'));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'blank_theme_hide_tagline', array('label' => __('Hide Tagline', 'blank-theme'), 'section' => 'title_tagline', 'settings' => 'blank_theme_hide_tagline', 'type' => 'checkbox')));
     /************************** GENERAL ***************************/
     $wp_customize->add_panel('blank_theme_general_panel', array('priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('General', 'blank-theme')));
     /*==============================
                 SIDEBAR POSITIONS
       ===============================*/
     $wp_customize->add_section('blank_theme_sidebar_position_section', array('title' => __('Sidebar Position', 'blank-theme'), 'capability' => 'edit_theme_options', 'description' => __('', 'blank-theme'), 'panel' => 'blank_theme_general_panel'));
     $wp_customize->add_setting('blank_theme_sidebar_position', array('default' => 'right', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'blank_theme_sanitize_choices'));
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'blank_theme_sidebar_position', array('label' => __('Sidebar Position', 'blank-theme'), 'section' => 'blank_theme_sidebar_position_section', 'settings' => 'blank_theme_sidebar_position', 'type' => 'radio', 'choices' => array('left' => __('Left', 'blank-theme'), 'right' => __('Right', 'blank-theme')))));
     /*==============================
             Footer Copyright Text
       ===============================*/
     $wp_customize->add_section('blank_theme_copyright_text_section', array('title' => __('Copyright Text', 'blank-theme'), 'capability' => 'edit_theme_options', 'description' => __('Will override the footer copyright text', 'blank-theme'), 'panel' => 'blank_theme_general_panel'));
     //SPECIAL FONTS
     $wp_customize->add_setting('blank_theme_copyright_text', array('default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field'));
     $wp_customize->add_control('blank_theme_copyright_text', array('label' => __('Copyright Text', 'blank-theme'), 'section' => 'blank_theme_copyright_text_section', 'settings' => 'blank_theme_copyright_text', 'type' => 'text'));
     /*==============================
                 SLIDER
       ===============================*/
     $wp_customize->add_panel('blank_theme_pannel', array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Slider Options', 'blank-theme'), 'description' => __('Add slider', 'blank-theme')));
     for ($i = 1; $i <= 8; $i++) {
         $wp_customize->add_section('blank_theme_section_' . $i, array('priority' => 10, 'capability' => 'edit_theme_options', 'title' => sprintf(__('Slide %s', 'blank-theme'), $i), 'description' => __('Add slide', 'blank-theme'), 'panel' => 'blank_theme_pannel'));
         $wp_customize->add_setting('blank_theme_slides[' . $i . '][title]', array('default' => '', 'sanitize_callback' => 'sanitize_text_field', 'capability' => 'edit_theme_options'));
         $wp_customize->add_control('blank_theme_slides[' . $i . '][title]', array('priority' => 10, 'section' => 'blank_theme_section_' . $i, 'label' => __('Title', 'blank-theme'), 'settings' => 'blank_theme_slides[' . $i . '][title]'));
         $wp_customize->add_setting('blank_theme_slides[' . $i . '][description]', array('default' => '', 'sanitize_callback' => 'sanitize_text_field', 'capability' => 'edit_theme_options'));
         $wp_customize->add_control('blank_theme_slides[' . $i . '][description]', array('priority' => 10, 'section' => 'blank_theme_section_' . $i, 'label' => __('Description', 'blank-theme'), 'settings' => 'blank_theme_slides[' . $i . '][description]'));
         $wp_customize->add_setting('blank_theme_slides[' . $i . '][link]', array('default' => '', 'sanitize_callback' => 'esc_url_raw', 'capability' => 'edit_theme_options'));
         $wp_customize->add_control('blank_theme_slides[' . $i . '][link]', array('priority' => 10, 'section' => 'blank_theme_section_' . $i, 'label' => __('Link', 'blank-theme'), 'settings' => 'blank_theme_slides[' . $i . '][link]'));
         $wp_customize->add_setting('blank_theme_slides[' . $i . '][image]', array('default' => '', 'sanitize_callback' => 'esc_url_raw', 'capability' => 'edit_theme_options'));
         $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'blank_theme_slides[' . $i . '][image]', array('priority' => 10, 'section' => 'blank_theme_section_' . $i, 'label' => __('Image', 'blank-theme'), 'settings' => 'blank_theme_slides[' . $i . '][image]')));
     }
     //4. We can also change built-in settings by modifying properties. For instance, let's make some stuff use live preview JS...
     $wp_customize->get_setting('blogname')->transport = 'postMessage';
     $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
     $wp_customize->get_setting('background_color')->transport = 'postMessage';
     $wp_customize->remove_control('header_image');
     //$wp_customize->remove_control('header_textcolor');
 }
Пример #18
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function hovercraft_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    /* Colors */
    $wp_customize->add_panel('hovercraft_colors', array('title' => __('Colors', 'hovercraft'), 'description' => 'Customize text, link, and background colors.', 'priority' => 100));
    $color_sections = array(array('header_colors', 'Header Colors', array(array('header_background_color', 'Header Background', '#eeeeee'), array('header_text_color', 'Header Text', '#000000'), array('header_link_color', 'Header Link', '#00554e'))), array('content_colors', 'Content Colors', array(array('content_background_color', 'Content Background', '#ffffff'), array('content_text_color', 'Content Text', '#000000'), array('content_link_color', 'Content Link', '#00554e'))), array('sidebar_colors', 'Sidebar Colors', array(array('sidebar_background_color', 'Sidebar Background', '#ffffff'), array('sidebar_text_color', 'Sidebar Text', '#000000'), array('sidebar_link_color', 'Sidebar Link', '#00554e'))), array('footer_colors', 'Footer Colors', array(array('footer_background_color', 'Footer Background', '#444444'), array('footer_text_color', 'Footer Text', '#ffffff'), array('footer_link_color', 'Footer Link', '#a1fff6'))));
    foreach ($color_sections as $color_section) {
        $section_id = 'hovercraft_' . $color_section[0];
        $section_name = $color_section[1];
        $section_settings = $color_section[2];
        $wp_customize->add_section($section_id, array('title' => __($section_name, 'hovercraft'), 'panel' => 'hovercraft_colors'));
        foreach ($section_settings as $color_setting) {
            $widget_id = $color_setting[0];
            $setting_id = 'hovercraft_' . $color_setting[0];
            $setting_name = $color_setting[1];
            $setting_default = $color_setting[2];
            $wp_customize->add_setting($setting_id, array('default' => $setting_default, 'sanitize_callback' => 'sanitize_hex_color'));
            $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $widget_id, array('label' => __($setting_name, 'hovercraft'), 'section' => $section_id, 'settings' => $setting_id)));
        }
    }
    /* Theme logo */
    $wp_customize->add_setting('hovercraft_logo');
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'hovercraft_logo', array('label' => __('Logo', 'hovercraft'), 'section' => 'title_tagline', 'settings' => 'hovercraft_logo', 'description' => 'Upload a logo for the header with a maximum height of 75px.')));
    /* Theme options slider section */
    $wp_customize->add_section('hovercraft_slider_options', array('title' => __('Slider', 'hovercraft'), 'priority' => 900, 'description' => 'To customize the appearance of the fullscreen slider choose any of the options below.'));
    /* Theme options sidebar section */
    $wp_customize->add_section('hovercraft_sidebar_options', array('title' => __('Sidebar', 'hovercraft'), 'priority' => 150, 'description' => 'Select whether the sidebar should be displayed at the right or left side of the content.'));
    /* Slider animation. */
    $wp_customize->add_setting('hovercraft_slider_animation', array('default' => 'fade', 'sanitize_callback' => 'hovercraft_sanitize_slider_animation'));
    $wp_customize->add_control('hovercraft_slider_animation', array('label' => __('Animation Type', 'hovercraft'), 'section' => 'hovercraft_slider_options', 'priority' => 1, 'type' => 'radio', 'choices' => array('fade' => __('Fade', 'hovercraft'), 'slide' => __('Slide', 'hovercraft'))));
    /* Slider slideshow. */
    $wp_customize->add_setting('hovercraft_slider_slideshow', array('default' => 'true', 'sanitize_callback' => 'hovercraft_sanitize_slider_slideshow'));
    $wp_customize->add_control('hovercraft_slider_slideshow', array('label' => __('Advance Automatically', 'hovercraft'), 'section' => 'hovercraft_slider_options', 'priority' => 2, 'type' => 'radio', 'choices' => array('true' => __('True', 'hovercraft'), 'false' => __('False', 'hovercraft'))));
    /* Slider slideshow speed. */
    $wp_customize->add_setting('hovercraft_slider_delay', array('default' => 10, 'sanitize_callback' => 'hovercraft_sanitize_slider_delay'));
    $wp_customize->add_control('hovercraft_slider_delay', array('label' => __('Delay', 'hovercraft'), 'description' => __('Enter the number of seconds per slide.', 'hovercraft'), 'section' => 'hovercraft_slider_options', 'priority' => 3, 'type' => 'number'));
    /* Left sidebar or right sidebar */
    $wp_customize->add_setting('hovercraft_sidebar', array('default' => 'right-sidebar', 'sanitize_callback' => 'hovercraft_sanitize_sidebar'));
    $wp_customize->add_control('hovercraft_sidebar', array('label' => __('Sidebar: ', 'hovercraft'), 'section' => 'hovercraft_sidebar_options', 'priority' => 1, 'type' => 'radio', 'choices' => array('right-sidebar' => __('Right sidebar', 'hovercraft'), 'left-sidebar' => __('Left sidebar', 'hovercraft'))));
    /* Remove the tagline control. */
    $wp_customize->remove_control('blogdescription');
}
Пример #19
0
/**
 * Add postMessage support for site title and description for the Customizer.
 *
 * @since Twenty Fifteen 1.0
 *
 * @param WP_Customize_Manager $wp_customize Customizer object.
 */
function broadwaydental_customize_register($wp_customize)
{
    $color_scheme = broadwaydental_get_color_scheme();
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    // Add color scheme setting and control.
    $wp_customize->add_setting('color_scheme', array('default' => 'default', 'sanitize_callback' => 'broadwaydental_sanitize_color_scheme', 'transport' => 'postMessage'));
    $wp_customize->add_control('color_scheme', array('label' => __('Base Color Scheme', 'broadwaydental'), 'section' => 'colors', 'type' => 'select', 'choices' => broadwaydental_get_color_scheme_choices(), 'priority' => 1));
    // Add custom header and sidebar text color setting and control.
    $wp_customize->add_setting('sidebar_textcolor', array('default' => $color_scheme[4], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'sidebar_textcolor', array('label' => __('Header and Sidebar Text Color', 'broadwaydental'), 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'broadwaydental'), 'section' => 'colors')));
    // Remove the core header textcolor control, as it shares the sidebar text color.
    $wp_customize->remove_control('header_textcolor');
    // Add custom header and sidebar background color setting and control.
    $wp_customize->add_setting('header_background_color', array('default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_background_color', array('label' => __('Header and Sidebar Background Color', 'broadwaydental'), 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'broadwaydental'), 'section' => 'colors')));
    // Add an additional description to the header image section.
    $wp_customize->get_section('header_image')->description = __('Applied to the header on small screens and the sidebar on wide screens.', 'broadwaydental');
}
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function tesseract_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    $wp_customize->add_panel('tesseract_general_options', array('priority' => 3, 'capability' => 'edit_theme_options', 'title' => 'General'));
    $wp_customize->add_panel('tesseract_header_options', array('priority' => 4, 'capability' => 'edit_theme_options', 'title' => 'Header Options'));
    $wp_customize->add_panel('tesseract_footer_options', array('priority' => 5, 'capability' => 'edit_theme_options', 'title' => 'Footer Options'));
    $wp_customize->add_panel('tesseract_social', array('priority' => 9999, 'capability' => 'edit_theme_options', 'title' => 'Social'));
    $wp_customize->get_section('title_tagline')->panel = 'tesseract_header_options';
    $wp_customize->get_section('title_tagline')->priority = 3;
    $wp_customize->get_section('static_front_page')->panel = 'tesseract_general_options';
    $wp_customize->get_section('static_front_page')->priority = 4;
    $wp_customize->get_section('background_image')->panel = 'tesseract_general_options';
    $wp_customize->get_section('background_image')->priority = 2;
    $wp_customize->get_section('colors')->panel = 'tesseract_general_options';
    $wp_customize->get_section('colors')->title = __('Background Color', 'tesseract');
    $wp_customize->get_section('colors')->priority = 1;
    $wp_customize->get_control('background_color')->label = __('Choose a background color', 'tesseract');
    $wp_customize->get_control('background_color')->description = __('(This is only for the site\'s generic background color. You can define header and footer background colors in the Header Options and Footer Options respectively.)', 'tesseract');
    $wp_customize->remove_section('header_image');
    $wp_customize->remove_section('nav');
    $wp_customize->remove_control('header_textcolor');
    require get_template_directory() . '/inc/sections/header-colors.php';
    require get_template_directory() . '/inc/sections/logo.php';
    require get_template_directory() . '/inc/sections/header-menu.php';
    require get_template_directory() . '/inc/sections/header-content.php';
    require get_template_directory() . '/inc/sections/social/facebook.php';
    require get_template_directory() . '/inc/sections/social/twitter.php';
    require get_template_directory() . '/inc/sections/social/googleplus.php';
    require get_template_directory() . '/inc/sections/social/linkedin.php';
    require get_template_directory() . '/inc/sections/social/youtube.php';
    require get_template_directory() . '/inc/sections/social/vimeo.php';
    require get_template_directory() . '/inc/sections/social/tumblr.php';
    require get_template_directory() . '/inc/sections/social/flickr.php';
    require get_template_directory() . '/inc/sections/social/pinterest.php';
    require get_template_directory() . '/inc/sections/social/dribbble.php';
    require get_template_directory() . '/inc/sections/footer-colors.php';
    require get_template_directory() . '/inc/sections/footer-content.php';
    if ($wp_customize->is_preview() && !is_admin()) {
        add_action('wp_footer', 'tesseract_customize_preview', 21);
    }
}
Пример #21
0
/**
 * Add postMessage support for site title and description for the Customizer.
 *
 * @since Twenty Sixteen 1.0
 *
 * @param WP_Customize_Manager $wp_customize the Customizer object.
 */
function twentysixteen_customize_register($wp_customize)
{
    $color_scheme = twentysixteen_get_color_scheme();
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    // Add color scheme setting and control.
    $wp_customize->add_setting('color_scheme', array('default' => 'default', 'sanitize_callback' => 'twentysixteen_sanitize_color_scheme', 'transport' => 'postMessage'));
    $wp_customize->add_control('color_scheme', array('label' => __('Base Color Scheme', 'twentysixteen'), 'section' => 'colors', 'type' => 'select', 'choices' => twentysixteen_get_color_scheme_choices(), 'priority' => 1));
    // Add page background color setting and control.
    $wp_customize->add_setting('page_background_color', array('default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'page_background_color', array('label' => __('Page Background Color', 'twentysixteen'), 'section' => 'colors')));
    // Remove the core header textcolor control, as it shares the main text color.
    $wp_customize->remove_control('header_textcolor');
    // Add link color setting and control.
    $wp_customize->add_setting('link_color', array('default' => $color_scheme[2], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => __('Link Color', 'twentysixteen'), 'section' => 'colors')));
    // Add main text color setting and control.
    $wp_customize->add_setting('main_text_color', array('default' => $color_scheme[3], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'main_text_color', array('label' => __('Main Text Color', 'twentysixteen'), 'section' => 'colors')));
    // Add secondary text color setting and control.
    $wp_customize->add_setting('secondary_text_color', array('default' => $color_scheme[4], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'secondary_text_color', array('label' => __('Secondary Text Color', 'twentysixteen'), 'section' => 'colors')));
}
Пример #22
0
/**
 * Add postMessage support for site title and description for the Customizer.
 *
 * @since Twenty Fifteen 1.0
 *
 * @param WP_Customize_Manager $wp_customize Customizer object.
 */
function twentyfifteen_customize_register($wp_customize)
{
    $color_scheme = twentyfifteen_get_color_scheme();
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    if (isset($wp_customize->selective_refresh)) {
        $wp_customize->selective_refresh->add_partial('blogname', array('selector' => '.site-title a', 'container_inclusive' => false, 'render_callback' => 'twentyfifteen_customize_partial_blogname'));
        $wp_customize->selective_refresh->add_partial('blogdescription', array('selector' => '.site-description', 'container_inclusive' => false, 'render_callback' => 'twentyfifteen_customize_partial_blogdescription'));
    }
    // Add color scheme setting and control.
    $wp_customize->add_setting('color_scheme', array('default' => 'default', 'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme', 'transport' => 'postMessage'));
    $wp_customize->add_control('color_scheme', array('label' => __('Base Color Scheme', 'diductio'), 'section' => 'colors', 'type' => 'select', 'choices' => twentyfifteen_get_color_scheme_choices(), 'priority' => 1));
    // Add custom header and sidebar text color setting and control.
    $wp_customize->add_setting('sidebar_textcolor', array('default' => $color_scheme[4], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'sidebar_textcolor', array('label' => __('Header and Sidebar Text Color', 'diductio'), 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'diductio'), 'section' => 'colors')));
    // Remove the core header textcolor control, as it shares the sidebar text color.
    $wp_customize->remove_control('header_textcolor');
    // Add custom header and sidebar background color setting and control.
    $wp_customize->add_setting('header_background_color', array('default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_background_color', array('label' => __('Header and Sidebar Background Color', 'diductio'), 'description' => __('Applied to the header on small screens and the sidebar on wide screens.', 'diductio'), 'section' => 'colors')));
    // Add an additional description to the header image section.
    $wp_customize->get_section('header_image')->description = __('Applied to the header on small screens and the sidebar on wide screens.', 'diductio');
}
Пример #23
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function west_customize_register($wp_customize)
{
    $wp_customize->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 = 'west_header_panel';
    $wp_customize->get_section('title_tagline')->priority = '9';
    $wp_customize->get_section('title_tagline')->title = __('Site branding', 'west');
    $wp_customize->get_section('title_tagline')->panel = 'west_header_panel';
    $wp_customize->remove_control('header_textcolor');
    $wp_customize->remove_control('display_header_text');
    //Titles
    class West_Info extends WP_Customize_Control
    {
        public $type = 'info';
        public $label = '';
        public function render_content()
        {
            ?>
            <h3 style="margin-top:30px;border-bottom:1px solid;padding:5px;color:#111;text-transform:uppercase;"><?php 
            echo esc_html($this->label);
            ?>
</h3>
        <?php 
        }
    }
    //___Header area___//
    $wp_customize->add_panel('west_header_panel', array('priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Header area', 'west')));
    //___Header type___//
    $wp_customize->add_section('west_header_type', array('title' => __('Header type', 'west'), 'priority' => 10, 'panel' => 'west_header_panel', 'description' => __('Select your header type', 'west')));
    //Front page
    $wp_customize->add_setting('front_header_type', array('default' => 'image', 'sanitize_callback' => 'west_sanitize_header'));
    $wp_customize->add_control('front_header_type', array('type' => 'radio', 'label' => __('Front page header type', 'west'), 'section' => 'west_header_type', 'description' => __('Select the header type for your front page', 'west'), 'choices' => array('image' => __('Image', 'west'), 'nothing' => __('Only menu', 'west'))));
    //Site
    $wp_customize->add_setting('site_header_type', array('default' => 'image', 'sanitize_callback' => 'west_sanitize_header'));
    $wp_customize->add_control('site_header_type', array('type' => 'radio', 'label' => __('Site header type', 'west'), 'section' => 'west_header_type', 'description' => __('Select the header type for all pages except the front page', 'west'), 'choices' => array('image' => __('Image', 'west'), 'nothing' => __('Only menu', 'west'))));
    //___Header text___//
    $wp_customize->add_section('west_header_text', array('title' => __('Header text', 'west'), 'priority' => 14, 'panel' => 'west_header_panel'));
    $wp_customize->add_setting('header_text', array('default' => __('TIME TO GO WEST', 'west'), 'sanitize_callback' => 'west_sanitize_text'));
    $wp_customize->add_control('header_text', array('label' => __('Header text', 'west'), 'section' => 'west_header_text', 'type' => 'text', 'priority' => 10));
    $wp_customize->add_setting('button_left', array('default' => __('Explore', 'west'), 'sanitize_callback' => 'west_sanitize_text'));
    $wp_customize->add_control('button_left', array('label' => __('Left button text', 'west'), 'section' => 'west_header_text', 'type' => 'text', 'priority' => 10));
    $wp_customize->add_setting('button_left_url', array('default' => '#primary', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('button_left_url', array('label' => __('Left button URL', 'west'), 'section' => 'west_header_text', 'type' => 'text', 'priority' => 11));
    $wp_customize->add_setting('button_right', array('default' => __('Browse', 'west'), 'sanitize_callback' => 'west_sanitize_text'));
    $wp_customize->add_control('button_right', array('label' => __('Right button text', 'west'), 'section' => 'west_header_text', 'type' => 'text', 'priority' => 12));
    $wp_customize->add_setting('button_right_url', array('default' => '#primary', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control('button_right_url', array('label' => __('Right button URL', 'west'), 'section' => 'west_header_text', 'type' => 'text', 'priority' => 13));
    //___Mobile header image___//
    $wp_customize->add_setting('mobile_header', array('default-image' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'mobile_header', array('label' => __('Small screens header image', 'west'), 'type' => 'image', 'section' => 'header_image', 'settings' => 'mobile_header', 'description' => __('Add a header image for screen widths smaller than 1024px', 'west'), 'priority' => 10)));
    //___Menu style___//
    $wp_customize->add_section('west_menu_style', array('title' => __('Menu style', 'west'), 'priority' => 15, 'panel' => 'west_header_panel'));
    //Sticky menu
    $wp_customize->add_setting('sticky_menu', array('default' => 'sticky', 'sanitize_callback' => 'west_sanitize_sticky'));
    $wp_customize->add_control('sticky_menu', array('type' => 'radio', 'priority' => 10, 'label' => __('Sticky menu', 'west'), 'section' => 'west_menu_style', 'choices' => array('sticky' => __('Sticky', 'west'), 'static' => __('Static', 'west'))));
    //Menu style
    $wp_customize->add_setting('menu_style', array('default' => 'inline', 'sanitize_callback' => 'west_sanitize_menu_style'));
    $wp_customize->add_control('menu_style', array('type' => 'radio', 'priority' => 11, 'label' => __('Menu style', 'west'), 'section' => 'west_menu_style', 'choices' => array('inline' => __('Inline', 'west'), 'centered' => __('Centered', 'west'))));
    //Logo Upload
    $wp_customize->add_setting('site_logo', array('default-image' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'site_logo', array('label' => __('Upload your logo', 'west'), 'type' => 'image', 'section' => 'title_tagline', 'priority' => 12)));
    //___Blog options___//
    $wp_customize->add_section('blog_options', array('title' => __('Blog options', 'west'), 'priority' => 13));
    // Blog layout
    $wp_customize->add_setting('west_options[info]', array('type' => 'info_control', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr'));
    $wp_customize->add_control(new West_Info($wp_customize, 'layout', array('label' => __('Layout', 'west'), 'section' => 'blog_options', 'settings' => 'west_options[info]', 'priority' => 10)));
    $wp_customize->add_setting('blog_layout', array('default' => 'classic', 'sanitize_callback' => 'west_sanitize_blog'));
    $wp_customize->add_control('blog_layout', array('type' => 'radio', 'label' => __('Blog layout', 'west'), 'section' => 'blog_options', 'priority' => 11, 'choices' => array('classic' => __('Classic', 'west'), 'fullwidth' => __('Full width (no sidebar)', 'west'), 'masonry-layout' => __('Masonry (grid style)', 'west'))));
    //Full width singles
    $wp_customize->add_setting('fullwidth_single', array('sanitize_callback' => 'west_sanitize_checkbox'));
    $wp_customize->add_control('fullwidth_single', array('type' => 'checkbox', 'label' => __('Full width single posts?', 'west'), 'section' => 'blog_options', 'priority' => 12));
    //Excerpt
    $wp_customize->add_setting('west_options[info]', array('type' => 'info_control', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr'));
    $wp_customize->add_control(new West_Info($wp_customize, 'content', array('label' => __('Excerpt', 'west'), 'section' => 'blog_options', 'settings' => 'west_options[info]', 'priority' => 13)));
    //Excerpt
    $wp_customize->add_setting('exc_lenght', array('sanitize_callback' => 'absint', 'default' => '30'));
    $wp_customize->add_control('exc_lenght', array('type' => 'number', 'priority' => 16, 'section' => 'blog_options', 'label' => __('Excerpt lenght', 'west'), 'description' => __('Excerpt length [default: 30 words]', 'west'), 'input_attrs' => array('min' => 10, 'max' => 200, 'step' => 5, 'style' => 'padding: 15px;')));
    //Meta
    $wp_customize->add_setting('west_options[info]', array('type' => 'info_control', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr'));
    $wp_customize->add_control(new West_Info($wp_customize, 'meta', array('label' => __('Meta', 'west'), 'section' => 'blog_options', 'settings' => 'west_options[info]', 'priority' => 17)));
    //Hide meta index
    $wp_customize->add_setting('hide_meta_index', array('sanitize_callback' => 'west_sanitize_checkbox', 'default' => 0));
    $wp_customize->add_control('hide_meta_index', array('type' => 'checkbox', 'label' => __('Hide post meta on index, archives?', 'west'), 'section' => 'blog_options', 'priority' => 18));
    //Hide meta single
    $wp_customize->add_setting('hide_meta_single', array('sanitize_callback' => 'west_sanitize_checkbox', 'default' => 0));
    $wp_customize->add_control('hide_meta_single', array('type' => 'checkbox', 'label' => __('Hide post meta on single posts?', 'west'), 'section' => 'blog_options', 'priority' => 19));
    //Featured images
    $wp_customize->add_setting('west_options[info]', array('type' => 'info_control', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr'));
    $wp_customize->add_control(new West_Info($wp_customize, 'images', array('label' => __('Featured images', 'west'), 'section' => 'blog_options', 'settings' => 'west_options[info]', 'priority' => 21)));
    //Index images
    $wp_customize->add_setting('index_feat_image', array('sanitize_callback' => 'west_sanitize_checkbox'));
    $wp_customize->add_control('index_feat_image', array('type' => 'checkbox', 'label' => __('Hide featured images on index, archives?', 'west'), 'section' => 'blog_options', 'priority' => 22));
    //Post images
    $wp_customize->add_setting('post_feat_image', array('sanitize_callback' => 'west_sanitize_checkbox'));
    $wp_customize->add_control('post_feat_image', array('type' => 'checkbox', 'label' => __('Hide featured images on single posts?', 'west'), 'section' => 'blog_options', 'priority' => 23));
    //___Fonts___//
    $wp_customize->add_section('west_fonts', array('title' => __('Fonts', 'west'), 'priority' => 15, 'description' => __('You can use any Google Fonts you want for the heading and/or body. See the fonts here: google.com/fonts. See the documentation if you need help with this: athemes.com/documentation/west', 'west')));
    //Body fonts
    $wp_customize->add_setting('body_font_name', array('default' => 'Roboto:400,400italic,500italic,500', 'sanitize_callback' => 'west_sanitize_text'));
    $wp_customize->add_control('body_font_name', array('label' => __('Body font name/style/sets', 'west'), 'section' => 'west_fonts', 'type' => 'text', 'priority' => 11));
    //Body fonts family
    $wp_customize->add_setting('body_font_family', array('default' => '\'Roboto\', serif', 'sanitize_callback' => 'west_sanitize_text'));
    $wp_customize->add_control('body_font_family', array('label' => __('Body font family', 'west'), 'section' => 'west_fonts', 'type' => 'text', 'priority' => 12));
    //Headings fonts
    $wp_customize->add_setting('headings_font_name', array('default' => 'Montserrat:400,700', 'sanitize_callback' => 'west_sanitize_text'));
    $wp_customize->add_control('headings_font_name', array('label' => __('Headings font name/style/sets', 'west'), 'section' => 'west_fonts', 'type' => 'text', 'priority' => 14));
    //Headings fonts family
    $wp_customize->add_setting('headings_font_family', array('default' => '\'Montserrat\', serif', 'sanitize_callback' => 'west_sanitize_text'));
    $wp_customize->add_control('headings_font_family', array('label' => __('Headings font family', 'west'), 'section' => 'west_fonts', 'type' => 'text', 'priority' => 15));
    // Site title
    $wp_customize->add_setting('site_title_size', array('sanitize_callback' => 'absint', 'default' => '36', 'transport' => 'postMessage'));
    $wp_customize->add_control('site_title_size', array('type' => 'number', 'priority' => 17, 'section' => 'west_fonts', 'label' => __('Site title', 'west'), 'input_attrs' => array('min' => 10, 'max' => 90, 'step' => 1, 'style' => 'margin-bottom: 15px; padding: 10px;')));
    // Site description
    $wp_customize->add_setting('site_desc_size', array('sanitize_callback' => 'absint', 'default' => '14', 'transport' => 'postMessage'));
    $wp_customize->add_control('site_desc_size', array('type' => 'number', 'priority' => 17, 'section' => 'west_fonts', 'label' => __('Site description', 'west'), 'input_attrs' => array('min' => 10, 'max' => 50, 'step' => 1, 'style' => 'margin-bottom: 15px; padding: 10px;')));
    //H1 size
    $wp_customize->add_setting('h1_size', array('sanitize_callback' => 'absint', 'default' => '36', 'transport' => 'postMessage'));
    $wp_customize->add_control('h1_size', array('type' => 'number', 'priority' => 17, 'section' => 'west_fonts', 'label' => __('H1 font size', 'west'), 'input_attrs' => array('min' => 10, 'max' => 60, 'step' => 1, 'style' => 'margin-bottom: 15px; padding: 10px;')));
    //H2 size
    $wp_customize->add_setting('h2_size', array('sanitize_callback' => 'absint', 'default' => '30', 'transport' => 'postMessage'));
    $wp_customize->add_control('h2_size', array('type' => 'number', 'priority' => 18, 'section' => 'west_fonts', 'label' => __('H2 font size', 'west'), 'input_attrs' => array('min' => 10, 'max' => 60, 'step' => 1, 'style' => 'margin-bottom: 15px; padding: 10px;')));
    //H3 size
    $wp_customize->add_setting('h3_size', array('sanitize_callback' => 'absint', 'default' => '24', 'transport' => 'postMessage'));
    $wp_customize->add_control('h3_size', array('type' => 'number', 'priority' => 19, 'section' => 'west_fonts', 'label' => __('H3 font size', 'west'), 'input_attrs' => array('min' => 10, 'max' => 60, 'step' => 1, 'style' => 'margin-bottom: 15px; padding: 10px;')));
    //H4 size
    $wp_customize->add_setting('h4_size', array('sanitize_callback' => 'absint', 'default' => '18', 'transport' => 'postMessage'));
    $wp_customize->add_control('h4_size', array('type' => 'number', 'priority' => 20, 'section' => 'west_fonts', 'label' => __('H4 font size', 'west'), 'input_attrs' => array('min' => 10, 'max' => 60, 'step' => 1, 'style' => 'margin-bottom: 15px; padding: 10px;')));
    //H5 size
    $wp_customize->add_setting('h5_size', array('sanitize_callback' => 'absint', 'default' => '14', 'transport' => 'postMessage'));
    $wp_customize->add_control('h5_size', array('type' => 'number', 'priority' => 21, 'section' => 'west_fonts', 'label' => __('H5 font size', 'west'), 'input_attrs' => array('min' => 10, 'max' => 60, 'step' => 1, 'style' => 'margin-bottom: 15px; padding: 10px;')));
    //H6 size
    $wp_customize->add_setting('h6_size', array('sanitize_callback' => 'absint', 'default' => '12', 'transport' => 'postMessage'));
    $wp_customize->add_control('h6_size', array('type' => 'number', 'priority' => 22, 'section' => 'west_fonts', 'label' => __('H6 font size', 'west'), 'input_attrs' => array('min' => 10, 'max' => 60, 'step' => 1, 'style' => 'margin-bottom: 15px; padding: 10px;')));
    //Body
    $wp_customize->add_setting('body_size', array('sanitize_callback' => 'absint', 'default' => '14', 'transport' => 'postMessage'));
    $wp_customize->add_control('body_size', array('type' => 'number', 'priority' => 23, 'section' => 'west_fonts', 'label' => __('Body font size', 'west'), 'input_attrs' => array('min' => 10, 'max' => 24, 'step' => 1, 'style' => 'margin-bottom: 15px; padding: 10px;')));
    //___Colors___//
    //Primary color
    $wp_customize->add_setting('primary_color', array('default' => '#EAAB1C', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'primary_color', array('label' => __('Primary color', 'west'), 'section' => 'colors', 'settings' => 'primary_color', 'priority' => 12)));
    //Menu
    $wp_customize->add_setting('menu_bg', array('default' => '#1C1E21', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'menu_bg', array('label' => __('Menu background', 'west'), 'section' => 'colors', 'settings' => 'menu_bg', 'priority' => 16)));
    //Menu scroll
    $wp_customize->add_setting('menu_bg_scroll', array('default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'menu_bg_scroll', array('label' => __('Menu background (scroll mode)', 'west'), 'section' => 'colors', 'settings' => 'menu_bg_scroll', 'priority' => 17)));
    //Body
    $wp_customize->add_setting('body_text_color', array('default' => '#969CB3', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'body_text_color', array('label' => __('Body text', 'west'), 'section' => 'colors', 'settings' => 'body_text_color', 'priority' => 22)));
    //Footer
    $wp_customize->add_setting('footer_bg', array('default' => '#1C1E29', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer_bg', array('label' => __('Footer background', 'west'), 'section' => 'colors', 'settings' => 'footer_bg', 'priority' => 23)));
    //___Footer___//
    $wp_customize->add_section('west_footer', array('title' => __('Footer widgets', 'west'), 'priority' => 18));
    $wp_customize->add_setting('footer_widget_areas', array('default' => '3', 'sanitize_callback' => 'west_sanitize_fwidgets'));
    $wp_customize->add_control('footer_widget_areas', array('type' => 'radio', 'label' => __('Footer widget area', 'west'), 'section' => 'west_footer', 'description' => __('Choose the number of widget areas in the footer, then go to Appearance > Widgets and add your widgets.', 'west'), 'choices' => array('1' => __('One', 'west'), '2' => __('Two', 'west'), '3' => __('Three', 'west'))));
}
Пример #24
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function store_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    //Logo Settings
    $wp_customize->add_section('title_tagline', array('title' => __('Title, Tagline & Logo', 'store'), 'priority' => 30));
    $wp_customize->add_setting('store_logo', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'store_logo', array('label' => 'Upload Logo', 'section' => 'title_tagline', 'settings' => 'store_logo', 'priority' => 5)));
    $wp_customize->add_setting('store_logo_resize', array('default' => 100, 'sanitize_callback' => 'store_sanitize_positive_number'));
    $wp_customize->add_control('store_logo_resize', array('label' => __('Resize & Adjust Logo', 'store'), 'section' => 'title_tagline', 'settings' => 'store_logo_resize', 'priority' => 6, 'type' => 'range', 'active_callback' => 'store_logo_enabled', 'input_attrs' => array('min' => 30, 'max' => 200, 'step' => 5)));
    function store_logo_enabled($control)
    {
        $option = $control->manager->get_setting('store_logo');
        return $option->value() == true;
    }
    //Replace Header Text Color with, separate colors for Title and Description
    //Override store_site_titlecolor
    $wp_customize->remove_control('display_header_text');
    $wp_customize->remove_setting('header_textcolor');
    $wp_customize->add_setting('store_site_titlecolor', array('default' => '#FFFFFF', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'store_site_titlecolor', array('label' => __('Site Title Color', 'store'), 'section' => 'colors', 'settings' => 'store_site_titlecolor', 'type' => 'color')));
    $wp_customize->add_setting('store_header_desccolor', array('default' => '#FFFFFF', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'store_header_desccolor', array('label' => __('Site Tagline Color', 'store'), 'section' => 'colors', 'settings' => 'store_header_desccolor', 'type' => 'color')));
    //Settings for Nav Area
    $wp_customize->add_setting('store_disable_nav_desc', array('default' => false, 'sanitize_callback' => 'store_sanitize_checkbox'));
    $wp_customize->add_control('store_disable_nav_desc', array('label' => __('Disable Description of Menu Items', 'store'), 'section' => 'nav', 'settings' => 'store_disable_nav_desc', 'type' => 'checkbox'));
    //Settings For Logo Area
    $wp_customize->add_setting('store_hide_title_tagline', array('sanitize_callback' => 'store_sanitize_checkbox'));
    $wp_customize->add_control('store_hide_title_tagline', array('settings' => 'store_hide_title_tagline', 'label' => __('Hide Title and Tagline.', 'store'), 'section' => 'title_tagline', 'type' => 'checkbox'));
    function store_title_visible($control)
    {
        $option = $control->manager->get_setting('store_hide_title_tagline');
        return $option->value() == false;
    }
    //SLIDER
    // SLIDER PANEL
    $wp_customize->add_panel('store_slider_panel', array('priority' => 35, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => 'Main Slider'));
    $wp_customize->add_section('store_sec_slider_options', array('title' => 'Enable/Disable', 'priority' => 0, 'panel' => 'store_slider_panel'));
    $wp_customize->add_setting('store_main_slider_enable', array('sanitize_callback' => 'store_sanitize_checkbox'));
    $wp_customize->add_control('store_main_slider_enable', array('settings' => 'store_main_slider_enable', 'label' => __('Enable Slider on HomePage.', 'store'), 'section' => 'store_sec_slider_options', 'type' => 'checkbox'));
    $wp_customize->add_setting('store_main_slider_count', array('default' => '0', 'sanitize_callback' => 'store_sanitize_positive_number'));
    // Select How Many Slides the User wants, and Reload the Page.
    $wp_customize->add_control('store_main_slider_count', array('settings' => 'store_main_slider_count', 'label' => __('No. of Slides(Min:0, Max: 10)', 'store'), 'section' => 'store_sec_slider_options', 'type' => 'number', 'description' => __('Save the Settings, and Reload this page to Configure the Slides.', 'store')));
    for ($i = 1; $i <= 10; $i++) {
        //Create the settings Once, and Loop through it.
        static $x = 0;
        $wp_customize->add_section('store_slide_sec' . $i, array('title' => 'Slide ' . $i, 'priority' => $i, 'panel' => 'store_slider_panel', 'active_callback' => 'store_show_slide_sec'));
        $wp_customize->add_setting('store_slide_img' . $i, array('sanitize_callback' => 'esc_url_raw'));
        $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'store_slide_img' . $i, array('label' => '', 'section' => 'store_slide_sec' . $i, 'settings' => 'store_slide_img' . $i)));
        $wp_customize->add_setting('store_slide_title' . $i, array('sanitize_callback' => 'sanitize_text_field'));
        $wp_customize->add_control('store_slide_title' . $i, array('settings' => 'store_slide_title' . $i, 'label' => __('Slide Title', 'store'), 'section' => 'store_slide_sec' . $i, 'type' => 'text'));
        $wp_customize->add_setting('store_slide_desc' . $i, array('sanitize_callback' => 'sanitize_text_field'));
        $wp_customize->add_control('store_slide_desc' . $i, array('settings' => 'store_slide_desc' . $i, 'label' => __('Slide Description', 'store'), 'section' => 'store_slide_sec' . $i, 'type' => 'text'));
        $wp_customize->add_setting('store_slide_CTA_button' . $i, array('sanitize_callback' => 'sanitize_text_field'));
        $wp_customize->add_control('store_slide_CTA_button' . $i, array('settings' => 'store_slide_CTA_button' . $i, 'label' => __('Custom Call to Action Button Text(Optional)', 'store'), 'section' => 'store_slide_sec' . $i, 'type' => 'text'));
        $wp_customize->add_setting('store_slide_url' . $i, array('sanitize_callback' => 'esc_url_raw'));
        $wp_customize->add_control('store_slide_url' . $i, array('settings' => 'store_slide_url' . $i, 'label' => __('Target URL', 'store'), 'section' => 'store_slide_sec' . $i, 'type' => 'url'));
    }
    //active callback to see if the slide section is to be displayed or not
    function store_show_slide_sec($control)
    {
        $option = $control->manager->get_setting('store_main_slider_count');
        global $x;
        if ($x < $option->value()) {
            $x++;
            return true;
        }
    }
    if (class_exists('woocommerce')) {
        // CREATE THE fcp PANEL
        $wp_customize->add_panel('store_fcp_panel', array('priority' => 40, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => 'Featured Product Showcase', 'description' => ''));
        //SQUARE BOXES
        $wp_customize->add_section('store_fc_boxes', array('title' => 'Square Boxes', 'priority' => 10, 'panel' => 'store_fcp_panel'));
        $wp_customize->add_setting('store_box_enable', array('sanitize_callback' => 'store_sanitize_checkbox'));
        $wp_customize->add_control('store_box_enable', array('settings' => 'store_box_enable', 'label' => __('Enable Square Boxes & Posts Slider.', 'store'), 'section' => 'store_fc_boxes', 'type' => 'checkbox'));
        $wp_customize->add_setting('store_box_title', array('sanitize_callback' => 'sanitize_text_field'));
        $wp_customize->add_control('store_box_title', array('settings' => 'store_box_title', 'label' => __('Title for the Boxes', 'store'), 'section' => 'store_fc_boxes', 'type' => 'text'));
        $wp_customize->add_setting('store_box_cat', array('sanitize_callback' => 'store_sanitize_product_category'));
        $wp_customize->add_control(new WP_Customize_Product_Category_Control($wp_customize, 'store_box_cat', array('label' => __('Product Category.', 'store'), 'settings' => 'store_box_cat', 'section' => 'store_fc_boxes')));
        //SLIDER
        $wp_customize->add_section('store_fc_slider', array('title' => __('3D Cube Products Slider', 'store'), 'priority' => 10, 'panel' => 'store_fcp_panel', 'description' => 'This is the Posts Slider, displayed left to the square boxes.'));
        $wp_customize->add_setting('store_slider_title', array('sanitize_callback' => 'sanitize_text_field'));
        $wp_customize->add_control('store_slider_title', array('settings' => 'store_slider_title', 'label' => __('Title for the Slider', 'store'), 'section' => 'store_fc_slider', 'type' => 'text'));
        $wp_customize->add_setting('store_slider_count', array('sanitize_callback' => 'store_sanitize_positive_number'));
        $wp_customize->add_control('store_slider_count', array('settings' => 'store_slider_count', 'label' => __('No. of Posts(Min:3, Max: 10)', 'store'), 'section' => 'store_fc_slider', 'type' => 'range', 'input_attrs' => array('min' => 3, 'max' => 10, 'step' => 1, 'class' => 'test-class test', 'style' => 'color: #0a0')));
        $wp_customize->add_setting('store_slider_cat', array('sanitize_callback' => 'store_sanitize_product_category'));
        $wp_customize->add_control(new WP_Customize_Product_Category_Control($wp_customize, 'store_slider_cat', array('label' => __('Category For Slider.', 'store'), 'settings' => 'store_slider_cat', 'section' => 'store_fc_slider')));
        //COVERFLOW
        $wp_customize->add_section('store_fc_coverflow', array('title' => __('Top CoverFlow Slider', 'store'), 'priority' => 5, 'panel' => 'store_fcp_panel'));
        $wp_customize->add_setting('store_coverflow_enable', array('sanitize_callback' => 'store_sanitize_checkbox'));
        $wp_customize->add_control('store_coverflow_enable', array('settings' => 'store_coverflow_enable', 'label' => __('Enable', 'store'), 'section' => 'store_fc_coverflow', 'type' => 'checkbox'));
        $wp_customize->add_setting('store_coverflow_cat', array('sanitize_callback' => 'store_sanitize_product_category'));
        $wp_customize->add_control(new WP_Customize_Product_Category_Control($wp_customize, 'store_coverflow_cat', array('label' => __('Category For Image Grid', 'store'), 'settings' => 'store_coverflow_cat', 'section' => 'store_fc_coverflow')));
        $wp_customize->add_setting('store_coverflow_pc', array('sanitize_callback' => 'store_sanitize_positive_number'));
        $wp_customize->add_control('store_coverflow_pc', array('settings' => 'store_coverflow_pc', 'label' => __('Max No. of Posts in the Grid. Min: 5.', 'store'), 'section' => 'store_fc_coverflow', 'type' => 'number', 'default' => '0'));
    }
    //end class exists woocommerce
    //Extra Panel for Users, who dont have WooCommerce
    // CREATE THE fcp PANEL
    $wp_customize->add_panel('store_a_fcp_panel', array('priority' => 40, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => 'Featured Posts Showcase', 'description' => ''));
    //SQUARE BOXES
    $wp_customize->add_section('store_a_fc_boxes', array('title' => 'Square Boxes', 'priority' => 10, 'panel' => 'store_a_fcp_panel'));
    $wp_customize->add_setting('store_a_box_enable', array('sanitize_callback' => 'store_sanitize_checkbox'));
    $wp_customize->add_control('store_a_box_enable', array('settings' => 'store_a_box_enable', 'label' => __('Enable Square Boxes & Posts Slider.', 'store'), 'section' => 'store_a_fc_boxes', 'type' => 'checkbox'));
    $wp_customize->add_setting('store_a_box_title', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('store_a_box_title', array('settings' => 'store_a_box_title', 'label' => __('Title for the Boxes', 'store'), 'section' => 'store_a_fc_boxes', 'type' => 'text'));
    $wp_customize->add_setting('store_a_box_cat', array('sanitize_callback' => 'store_sanitize_product_category'));
    $wp_customize->add_control(new WP_Customize_Category_Control($wp_customize, 'store_a_box_cat', array('label' => __('Posts Category.', 'store'), 'settings' => 'store_a_box_cat', 'section' => 'store_a_fc_boxes')));
    //SLIDER
    $wp_customize->add_section('store_a_fc_slider', array('title' => __('3D Cube Products Slider', 'store'), 'priority' => 10, 'panel' => 'store_a_fcp_panel', 'description' => 'This is the Posts Slider, displayed left to the square boxes.'));
    $wp_customize->add_setting('store_a_slider_title', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('store_a_slider_title', array('settings' => 'store_a_slider_title', 'label' => __('Title for the Slider', 'store'), 'section' => 'store_a_fc_slider', 'type' => 'text'));
    $wp_customize->add_setting('store_a_slider_count', array('sanitize_callback' => 'store_sanitize_positive_number'));
    $wp_customize->add_control('store_a_slider_count', array('settings' => 'store_a_slider_count', 'label' => __('No. of Posts(Min:3, Max: 10)', 'store'), 'section' => 'store_a_fc_slider', 'type' => 'range', 'input_attrs' => array('min' => 3, 'max' => 10, 'step' => 1, 'class' => 'test-class test', 'style' => 'color: #0a0')));
    $wp_customize->add_setting('store_a_slider_cat', array('sanitize_callback' => 'store_sanitize_product_category'));
    $wp_customize->add_control(new WP_Customize_Category_Control($wp_customize, 'store_a_slider_cat', array('label' => __('Category For Slider.', 'store'), 'settings' => 'store_a_slider_cat', 'section' => 'store_a_fc_slider')));
    //COVERFLOW
    $wp_customize->add_section('store_a_fc_coverflow', array('title' => __('Top CoverFlow Slider', 'store'), 'priority' => 5, 'panel' => 'store_a_fcp_panel'));
    $wp_customize->add_setting('store_a_coverflow_title', array('sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('store_a_coverflow_title', array('settings' => 'store_a_coverflow_title', 'label' => __('Title for the Coverflow', 'store'), 'section' => 'store_a_fc_coverflow', 'type' => 'text'));
    $wp_customize->add_setting('store_a_coverflow_enable', array('sanitize_callback' => 'store_sanitize_checkbox'));
    $wp_customize->add_control('store_a_coverflow_enable', array('settings' => 'store_a_coverflow_enable', 'label' => __('Enable', 'store'), 'section' => 'store_a_fc_coverflow', 'type' => 'checkbox'));
    $wp_customize->add_setting('store_a_coverflow_cat', array('sanitize_callback' => 'store_sanitize_category'));
    $wp_customize->add_control(new WP_Customize_Category_Control($wp_customize, 'store_a_coverflow_cat', array('label' => __('Category For Image Grid', 'store'), 'settings' => 'store_a_coverflow_cat', 'section' => 'store_a_fc_coverflow')));
    $wp_customize->add_setting('store_a_coverflow_pc', array('sanitize_callback' => 'store_sanitize_positive_number'));
    $wp_customize->add_control('store_a_coverflow_pc', array('settings' => 'store_a_coverflow_pc', 'label' => __('Max No. of Posts in the Grid. Min: 5.', 'store'), 'section' => 'store_a_fc_coverflow', 'type' => 'number', 'default' => '0'));
    // Layout and Design
    $wp_customize->add_panel('store_design_panel', array('priority' => 40, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Design & Layout', 'store')));
    $wp_customize->add_section('store_design_options', array('title' => __('Blog Layout', 'store'), 'priority' => 0, 'panel' => 'store_design_panel'));
    $wp_customize->add_setting('store_blog_layout', array('sanitize_callback' => 'store_sanitize_blog_layout'));
    function store_sanitize_blog_layout($input)
    {
        if (in_array($input, array('grid', 'grid_2_column', 'store', 'store_3_column'))) {
            return $input;
        } else {
            return '';
        }
    }
    $wp_customize->add_control('store_blog_layout', array('label' => __('Select Layout', 'store'), 'settings' => 'store_blog_layout', 'section' => 'store_design_options', 'type' => 'select', 'choices' => array('grid' => __('Standard Blog Layout', 'store'), 'store' => __('Store Theme Layout', 'store'), 'store_3_column' => __('Store Theme Layout (3 Columns)', 'store'), 'grid_2_column' => __('Grid - 2 Column', 'store'))));
    $wp_customize->add_section('store_sidebar_options', array('title' => __('Sidebar Layout', 'store'), 'priority' => 0, 'panel' => 'store_design_panel'));
    $wp_customize->add_setting('store_disable_sidebar', array('sanitize_callback' => 'store_sanitize_checkbox'));
    $wp_customize->add_control('store_disable_sidebar', array('settings' => 'store_disable_sidebar', 'label' => __('Disable Sidebar Everywhere.', 'store'), 'section' => 'store_sidebar_options', 'type' => 'checkbox', 'default' => false));
    $wp_customize->add_setting('store_disable_sidebar_home', array('sanitize_callback' => 'store_sanitize_checkbox'));
    $wp_customize->add_control('store_disable_sidebar_home', array('settings' => 'store_disable_sidebar_home', 'label' => __('Disable Sidebar on Home/Blog.', 'store'), 'section' => 'store_sidebar_options', 'type' => 'checkbox', 'active_callback' => 'store_show_sidebar_options', 'default' => false));
    $wp_customize->add_setting('store_disable_sidebar_front', array('sanitize_callback' => 'store_sanitize_checkbox'));
    $wp_customize->add_control('store_disable_sidebar_front', array('settings' => 'store_disable_sidebar_front', 'label' => __('Disable Sidebar on Front Page.', 'store'), 'section' => 'store_sidebar_options', 'type' => 'checkbox', 'active_callback' => 'store_show_sidebar_options', 'default' => false));
    $wp_customize->add_setting('store_sidebar_width', array('default' => 4, 'sanitize_callback' => 'store_sanitize_positive_number'));
    $wp_customize->add_control('store_sidebar_width', array('settings' => 'store_sidebar_width', 'label' => __('Sidebar Width', 'store'), 'description' => __('Min: 25%, Default: 33%, Max: 40%', 'store'), 'section' => 'store_sidebar_options', 'type' => 'range', 'active_callback' => 'store_show_sidebar_options', 'input_attrs' => array('min' => 3, 'max' => 5, 'step' => 1, 'class' => 'sidebar-width-range', 'style' => 'color: #0a0')));
    /* Active Callback Function */
    function store_show_sidebar_options($control)
    {
        $option = $control->manager->get_setting('store_disable_sidebar');
        return $option->value() == false;
    }
    class Store_Custom_CSS_Control extends WP_Customize_Control
    {
        public $type = 'textarea';
        public function render_content()
        {
            ?>
	            <label>
	                <span class="customize-control-title"><?php 
            echo esc_html($this->label);
            ?>
</span>
	                <textarea rows="8" style="width:100%;" <?php 
            $this->link();
            ?>
><?php 
            echo esc_textarea($this->value());
            ?>
</textarea>
	            </label>
	        <?php 
        }
    }
    $wp_customize->add_section('store_custom_codes', array('title' => __('Custom CSS', 'store'), 'description' => __('Enter your Custom CSS to Modify design.', 'store'), 'priority' => 11, 'panel' => 'store_design_panel'));
    $wp_customize->add_setting('store_custom_css', array('default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_filter_nohtml_kses', 'sanitize_js_callback' => 'wp_filter_nohtml_kses'));
    $wp_customize->add_control(new Store_Custom_CSS_Control($wp_customize, 'store_custom_css', array('section' => 'store_custom_codes', 'settings' => 'store_custom_css')));
    function store_sanitize_text($input)
    {
        return wp_kses_post(force_balance_tags($input));
    }
    $wp_customize->add_section('store_custom_footer', array('title' => __('Custom Footer Text', 'store'), 'description' => __('Enter your Own Copyright Text.', 'store'), 'priority' => 11, 'panel' => 'store_design_panel'));
    $wp_customize->add_setting('store_footer_text', array('default' => '', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('store_footer_text', array('section' => 'store_custom_footer', 'settings' => 'store_footer_text', 'type' => 'text'));
    //Select the Default Theme Skin
    $wp_customize->add_section('store_skin_options', array('title' => __('Choose Skin', 'store'), 'priority' => 39));
    $wp_customize->add_setting('store_skin', array('default' => 'default', 'sanitize_callback' => 'store_sanitize_skin'));
    $skins = array('default' => __('Default(blue)', 'store'), 'orange' => __('Orange', 'store'), 'brown' => __('Brown', 'store'), 'green' => __('Green', 'store'), 'grayscale' => __('GrayScale', 'store'));
    $wp_customize->add_control('store_skin', array('settings' => 'store_skin', 'section' => 'store_skin_options', 'type' => 'select', 'choices' => $skins));
    function store_sanitize_skin($input)
    {
        if (in_array($input, array('default', 'orange', 'brown', 'green', 'grayscale'))) {
            return $input;
        } else {
            return '';
        }
    }
    //Fonts
    $wp_customize->add_section('store_typo_options', array('title' => __('Google Web Fonts', 'store'), 'priority' => 41, 'description' => __('Defaults: Lato, Open Sans.', 'store')));
    $font_array = array('Raleway', 'Khula', 'Open Sans', 'Droid Sans', 'Droid Serif', 'Roboto', 'Roboto Condensed', 'Lato', 'Bree Serif', 'Oswald', 'Slabo', 'Lora', 'Source Sans Pro', 'PT Sans', 'Ubuntu', 'Lobster', 'Arimo', 'Bitter', 'Noto Sans');
    $fonts = array_combine($font_array, $font_array);
    $wp_customize->add_setting('store_title_font', array('default' => 'Lato', 'sanitize_callback' => 'store_sanitize_gfont'));
    function store_sanitize_gfont($input)
    {
        if (in_array($input, array('Raleway', 'Khula', 'Open Sans', 'Droid Sans', 'Droid Serif', 'Roboto', 'Roboto Condensed', 'Lato', 'Bree Serif', 'Oswald', 'Slabo', 'Lora', 'Source Sans Pro', 'PT Sans', 'Ubuntu', 'Lobster', 'Arimo', 'Bitter', 'Noto Sans'))) {
            return $input;
        } else {
            return '';
        }
    }
    $wp_customize->add_control('store_title_font', array('label' => __('Title', 'store'), 'settings' => 'store_title_font', 'section' => 'store_typo_options', 'type' => 'select', 'choices' => $fonts));
    $wp_customize->add_setting('store_body_font', array('default' => 'Open Sans', 'sanitize_callback' => 'store_sanitize_gfont'));
    $wp_customize->add_control('store_body_font', array('label' => __('Body', 'store'), 'settings' => 'store_body_font', 'section' => 'store_typo_options', 'type' => 'select', 'choices' => $fonts));
    // Social Icons
    $wp_customize->add_section('store_social_section', array('title' => __('Social Icons', 'store'), 'priority' => 44));
    $social_networks = array('none' => __('-', 'store'), 'facebook' => __('Facebook', 'store'), 'twitter' => __('Twitter', 'store'), 'google-plus' => __('Google Plus', 'store'), 'instagram' => __('Instagram', 'store'), 'rss' => __('RSS Feeds', 'store'), 'vine' => __('Vine', 'store'), 'vimeo-square' => __('Vimeo', 'store'), 'youtube' => __('Youtube', 'store'), 'flickr' => __('Flickr', 'store'));
    $social_count = count($social_networks);
    for ($x = 1; $x <= $social_count - 3; $x++) {
        $wp_customize->add_setting('store_social_' . $x, array('sanitize_callback' => 'store_sanitize_social', 'default' => 'none'));
        $wp_customize->add_control('store_social_' . $x, array('settings' => 'store_social_' . $x, 'label' => __('Icon ', 'store') . $x, 'section' => 'store_social_section', 'type' => 'select', 'choices' => $social_networks));
        $wp_customize->add_setting('store_social_url' . $x, array('sanitize_callback' => 'esc_url_raw'));
        $wp_customize->add_control('store_social_url' . $x, array('settings' => 'store_social_url' . $x, 'description' => __('Icon ', 'store') . $x . __(' Url', 'store'), 'section' => 'store_social_section', 'type' => 'url', 'choices' => $social_networks));
    }
    function store_sanitize_social($input)
    {
        $social_networks = array('none', 'facebook', 'twitter', 'google-plus', 'instagram', 'rss', 'vine', 'vimeo-square', 'youtube', 'flickr');
        if (in_array($input, $social_networks)) {
            return $input;
        } else {
            return '';
        }
    }
    $wp_customize->add_section('store_sec_upgrade', array('title' => __('Store Theme - Help & Support', 'store'), 'priority' => 45));
    $wp_customize->add_setting('store_upgrade', array('sanitize_callback' => 'esc_textarea'));
    $wp_customize->add_control(new WP_Customize_Upgrade_Control($wp_customize, 'store_upgrade', array('label' => __('Thank You', 'store'), 'description' => __('Thank You for Choosing Store Theme by Rohitink.com. Store is a Powerful Wordpress theme which also supports WooCommerce in the best possible way. It is "as we say" the last theme you would ever need. It has all the basic and advanced features needed to run a gorgeous looking site. For any Help related to this theme, please visit  <a href="https://rohitink.com/2015/05/21/store-woocommerce-theme/">Store Help & Support</a>.', 'store'), 'section' => 'store_sec_upgrade', 'settings' => 'store_upgrade')));
    /* Sanitization Functions Common to Multiple Settings go Here, Specific Sanitization Functions are defined along with add_setting() */
    function store_sanitize_checkbox($input)
    {
        if ($input == 1) {
            return 1;
        } else {
            return '';
        }
    }
    function store_sanitize_positive_number($input)
    {
        if ($input >= 0 && is_numeric($input)) {
            return $input;
        } else {
            return '';
        }
    }
    function store_sanitize_category($input)
    {
        if (term_exists(get_cat_name($input), 'category')) {
            return $input;
        } else {
            return '';
        }
    }
    function store_sanitize_product_category($input)
    {
        if (get_term($input, 'product_cat')) {
            return $input;
        } else {
            return '';
        }
    }
}
Пример #25
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function amalgamation_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->remove_section('header_image');
    $wp_customize->remove_section('background_image');
    $wp_customize->remove_control('background_color');
    $wp_customize->remove_control('header_textcolor');
    $wp_customize->add_section('front_page_content', array('title' => __('Front Page Content', 'amalgamation'), 'description' => __('Content of panels of static front page. Does not apply if your front page is your blog archive.', 'amalgamation')));
    // post dropdown custom control modified from Tom Rhodes'
    // https://github.com/tommusrhodus/wp-cusomizer-posts-dropdown
    if (class_exists('WP_Customize_Control')) {
        class Post_Dropdown_Control extends WP_Customize_Control
        {
            public function render_content()
            {
                ?>
                <label>
                    <span class="customize-control-title"><?php 
                echo esc_html($this->label);
                ?>
</span>
                    <select data-customize-setting-link="<?php 
                echo $this->id;
                ?>
">
                        <?php 
                $posts = get_posts('numberposts=-1');
                foreach ($posts as $post) {
                    ?>
                            <option value="<?php 
                    echo $post->ID;
                    ?>
" <?php 
                    if (get_theme_mod($this->id) == $post->ID) {
                        echo 'selected="selected"';
                    }
                    ?>
><?php 
                    echo $post->post_title;
                    ?>
</option>
                        <?php 
                }
                ?>
                    </select>
                </label>
                <?php 
            }
        }
    }
    $wp_customize->add_setting('fp_panel_1', array('default' => 'latest', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage'));
    $wp_customize->add_control('fp_panel_1', array('label' => __('Content of panel 1 (upper left)', 'amalgamation'), 'description' => __('Includes title, excerpt, and featured image if any.', 'amalgamation'), 'section' => 'front_page_content', 'type' => 'radio', 'choices' => array('page' => __('Page', 'amalgamation'), 'latest' => __('Latest blog post', 'amalgamation'), 'post' => __('Fixed blog post', 'amalgamation'))));
    $wp_customize->add_setting('panel_1_page', array('default' => '', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage'));
    $wp_customize->add_control('panel_1_page', array('label' => __('Page to show', 'amalgamation'), 'section' => 'front_page_content', 'type' => 'dropdown-pages'));
    $wp_customize->add_setting('panel_1_post', array('default' => '', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage'));
    $wp_customize->add_control(new Post_Dropdown_Control($wp_customize, 'panel_1_post', array('label' => __('Post to show', 'amalgamation'), 'section' => 'front_page_content', 'settings' => 'panel_1_post')));
    $wp_customize->add_setting('fp_panel_2', array('default' => 'latest', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage'));
    $wp_customize->add_control('fp_panel_2', array('label' => __('Content of panel 2 (upper right)', 'amalgamation'), 'description' => __('Includes title, excerpt, and featured image if any.', 'amalgamation'), 'section' => 'front_page_content', 'type' => 'radio', 'choices' => array('page' => __('Page', 'amalgamation'), 'latest' => __('Latest blog post', 'amalgamation'), 'post' => __('Fixed blog post', 'amalgamation'))));
    $wp_customize->add_setting('panel_2_page', array('default' => '', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage'));
    $wp_customize->add_control('panel_2_page', array('label' => __('Page to show', 'amalgamation'), 'section' => 'front_page_content', 'type' => 'dropdown-pages'));
    $wp_customize->add_setting('panel_2_post', array('default' => '', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage'));
    $wp_customize->add_control(new Post_Dropdown_Control($wp_customize, 'panel_2_post', array('label' => __('Post to show', 'amalgamation'), 'section' => 'front_page_content', 'settings' => 'panel_2_post')));
    $wp_customize->add_setting('fp_panel_3', array('default' => 'latest', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage'));
    $wp_customize->add_control('fp_panel_3', array('label' => __('Content of panel 3 (lower left)', 'amalgamation'), 'description' => __('Includes title, excerpt, and featured image if any.', 'amalgamation'), 'section' => 'front_page_content', 'type' => 'radio', 'choices' => array('page' => __('Page', 'amalgamation'), 'latest' => __('Latest blog post', 'amalgamation'), 'post' => __('Fixed blog post', 'amalgamation'))));
    $wp_customize->add_setting('panel_3_page', array('default' => '', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage'));
    $wp_customize->add_control('panel_3_page', array('label' => __('Page to show', 'amalgamation'), 'section' => 'front_page_content', 'type' => 'dropdown-pages'));
    $wp_customize->add_setting('panel_3_post', array('default' => '', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage'));
    $wp_customize->add_control(new Post_Dropdown_Control($wp_customize, 'panel_3_post', array('label' => __('Post to show', 'amalgamation'), 'section' => 'front_page_content', 'settings' => 'panel_3_post')));
    $wp_customize->add_setting('fp_panel_4', array('default' => 'latest', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage'));
    $wp_customize->add_control('fp_panel_4', array('label' => __('Content of panel 4 (lower right)', 'amalgamation'), 'description' => __('Includes title, excerpt, and featured image if any.', 'amalgamation'), 'section' => 'front_page_content', 'type' => 'radio', 'choices' => array('page' => __('Page', 'amalgamation'), 'latest' => __('Latest blog post', 'amalgamation'), 'post' => __('Fixed blog post', 'amalgamation'))));
    $wp_customize->add_setting('panel_4_page', array('default' => '', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage'));
    $wp_customize->add_control('panel_4_page', array('label' => __('Page to show', 'amalgamation'), 'section' => 'front_page_content', 'type' => 'dropdown-pages'));
    $wp_customize->add_setting('panel_4_post', array('default' => '', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage'));
    $wp_customize->add_control(new Post_Dropdown_Control($wp_customize, 'panel_4_post', array('label' => __('Post to show', 'amalgamation'), 'section' => 'front_page_content', 'settings' => 'panel_4_post')));
    $wp_customize->add_section('archive_length', array('title' => __('Blog Archives', 'amalgamation'), 'description' => __('Choose whether blog archive pages show full content or post excerpts.', 'amalgamation')));
    $wp_customize->add_setting('archive_length_setting', array('default' => 'full', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('archive_length_setting', array('label' => __('Blog archives show:', 'amalgamation'), 'section' => 'archive_length', 'type' => 'radio', 'choices' => array('full' => __('Full content', 'amalgamation'), 'excerpt' => __('Excerpts', 'amalgamation'))));
}
Пример #26
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function parallax_one_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    /********************************************************/
    /************** WP DEFAULT CONTROLS  ********************/
    /********************************************************/
    $wp_customize->remove_control('background_color');
    $wp_customize->get_section('background_image')->panel = 'panel_2';
    $wp_customize->get_section('colors')->panel = 'panel_2';
    /********************************************************/
    /********************* APPEARANCE  **********************/
    /********************************************************/
    $wp_customize->add_panel('panel_2', array('priority' => 30, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => esc_html__('Appearance', 'parallax-one')));
    $wp_customize->add_setting('parallax_one_text_color', array('default' => '#313131', 'sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'parallax_one_text_color', array('label' => esc_html__('Text color', 'parallax-one'), 'section' => 'colors', 'priority' => 5)));
    $wp_customize->add_setting('parallax_one_title_color', array('default' => '#454545', 'sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'parallax_one_title_color', array('label' => esc_html__('Title color', 'parallax-one'), 'section' => 'colors', 'priority' => 6)));
    $wp_customize->add_section('parallax_one_appearance_general', array('title' => esc_html__('General options', 'parallax-one'), 'priority' => 3, 'description' => esc_html__('Paralax One theme general appearance options', 'parallax-one'), 'panel' => 'panel_2'));
    /* Logo	*/
    $wp_customize->add_setting('paralax_one_logo', array('default' => parallax_get_file('/images/logo-nav.png'), 'sanitize_callback' => 'esc_url', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'paralax_one_logo', array('label' => esc_html__('Logo', 'parallax-one'), 'section' => 'parallax_one_appearance_general', 'priority' => 1)));
    /* Sticky header */
    $wp_customize->add_setting('paralax_one_sticky_header', array('sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control('paralax_one_sticky_header', array('type' => 'checkbox', 'label' => esc_html__('Header visibility', 'parallax-one'), 'description' => esc_html__('If this box is checked, the header will toggle on frontpage.', 'parallax-one'), 'section' => 'parallax_one_appearance_general', 'priority' => 2));
    /********************************************************/
    /************* HEADER OPTIONS  ********************/
    /********************************************************/
    $wp_customize->add_panel('panel_1', array('priority' => 31, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => esc_html__('Header section', 'parallax-one')));
    /* HEADER CONTENT */
    $wp_customize->add_section('parallax_one_header_content', array('title' => esc_html__('Content', 'parallax-one'), 'priority' => 1, 'panel' => 'panel_1'));
    /* Header Logo	*/
    $wp_customize->add_setting('paralax_one_header_logo', array('default' => parallax_get_file('/images/logo-2.png'), 'sanitize_callback' => 'esc_url', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'paralax_one_header_logo', array('label' => esc_html__('Header Logo', 'parallax-one'), 'section' => 'parallax_one_header_content', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1)));
    /* Header title */
    $wp_customize->add_setting('parallax_one_header_title', array('default' => esc_html__('Simple, Reliable and Awesome.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_header_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_header_content', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    /* Header subtitle */
    $wp_customize->add_setting('parallax_one_header_subtitle', array('default' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_header_subtitle', array('label' => esc_html__('Subtitle', 'parallax-one'), 'section' => 'parallax_one_header_content', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 3));
    /*Header Button text*/
    $wp_customize->add_setting('parallax_one_header_button_text', array('default' => esc_html__('GET STARTED', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_header_button_text', array('label' => esc_html__('Button label', 'parallax-one'), 'section' => 'parallax_one_header_content', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 4));
    $wp_customize->add_setting('parallax_one_header_button_link', array('default' => esc_html__('#', 'parallax-one'), 'sanitize_callback' => 'esc_url', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_header_button_link', array('label' => esc_html__('Button link', 'parallax-one'), 'section' => 'parallax_one_header_content', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 5));
    /* LOGOS SETTINGS */
    $wp_customize->add_section('parallax_one_logos_settings_section', array('title' => esc_html__('Logos Bar', 'parallax-one'), 'priority' => 2, 'panel' => 'panel_1'));
    require_once 'class/parallax-one-general-control.php';
    $wp_customize->add_setting('parallax_one_logos_content', array('sanitize_callback' => 'parallax_one_sanitize_text', 'default' => json_encode(array(array("image_url" => parallax_get_file('/images/companies/7.png'), "link" => "#"), array("image_url" => parallax_get_file('/images/companies/9.png'), "link" => "#"), array("image_url" => parallax_get_file('/images/companies/8.png'), "link" => "#")))));
    $wp_customize->add_control(new Parallax_One_General_Repeater($wp_customize, 'parallax_one_logos_content', array('label' => esc_html__('Add new social icon', 'parallax-one'), 'section' => 'parallax_one_logos_settings_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1, 'parallax_image_control' => true, 'parallax_icon_control' => false, 'parallax_text_control' => false, 'parallax_link_control' => true)));
    $wp_customize->get_section('header_image')->panel = 'panel_1';
    /********************************************************/
    /****************** SERVICES OPTIONS  *******************/
    /********************************************************/
    /* SERVICES SECTION */
    $wp_customize->add_section('parallax_one_services_section', array('title' => esc_html__('Services section', 'parallax-one'), 'priority' => 32));
    /* Services title */
    $wp_customize->add_setting('parallax_one_our_services_title', array('default' => esc_html__('Our Services', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_our_services_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_services_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1));
    /* Services subtitle */
    $wp_customize->add_setting('parallax_one_our_services_subtitle', array('default' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_our_services_subtitle', array('label' => esc_html__('Subtitle', 'parallax-one'), 'section' => 'parallax_one_services_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    /* Services content */
    $wp_customize->add_setting('parallax_one_services_content', array('sanitize_callback' => 'parallax_one_sanitize_text', 'default' => json_encode(array(array('choice' => 'parallax_icon', 'icon_value' => 'icon-basic-webpage-multiple', 'title' => esc_html__('Lorem Ipsum', 'parallax-one'), 'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo.', 'parallax-one')), array('choice' => 'parallax_icon', 'icon_value' => 'icon-ecommerce-graph3', 'title' => esc_html__('Lorem Ipsum', 'parallax-one'), 'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo.', 'parallax-one')), array('choice' => 'parallax_icon', 'icon_value' => 'icon-basic-geolocalize-05', 'title' => esc_html__('Lorem Ipsum', 'parallax-one'), 'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo.', 'parallax-one'))))));
    $wp_customize->add_control(new Parallax_One_General_Repeater($wp_customize, 'parallax_one_services_content', array('label' => esc_html__('Add new service box', 'parallax-one'), 'section' => 'parallax_one_services_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 3, 'parallax_image_control' => true, 'parallax_icon_control' => true, 'parallax_title_control' => true, 'parallax_text_control' => true)));
    /********************************************************/
    /******************** ABOUT OPTIONS  ********************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_about_section', array('title' => esc_html__('About section', 'parallax-one'), 'priority' => 33));
    /* About title */
    $wp_customize->add_setting('parallax_one_our_story_title', array('default' => esc_html__('Our Story', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_our_story_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_about_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1));
    /* About Content */
    $wp_customize->add_setting('parallax_one_our_story_text', array('default' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_html', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_our_story_text', array('type' => 'textarea', 'label' => esc_html__('Content', 'parallax-one'), 'section' => 'parallax_one_about_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    /* About Image	*/
    $wp_customize->add_setting('paralax_one_our_story_image', array('default' => parallax_get_file('/images/about-us.png'), 'sanitize_callback' => 'esc_url', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'paralax_one_our_story_image', array('label' => esc_html__('Image', 'parallax-one'), 'section' => 'parallax_one_about_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 3)));
    /********************************************************/
    /*******************  TEAM OPTIONS  *********************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_team_section', array('title' => esc_html__('Team section', 'parallax-one'), 'priority' => 34));
    /* Team title */
    $wp_customize->add_setting('parallax_one_our_team_title', array('default' => esc_html__('Our Team', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_our_team_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_team_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1));
    /* Team subtitle */
    $wp_customize->add_setting('parallax_one_our_team_subtitle', array('default' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_our_team_subtitle', array('label' => esc_html__('Subtitle', 'parallax-one'), 'section' => 'parallax_one_team_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    /* Team content */
    $wp_customize->add_setting('parallax_one_team_content', array('sanitize_callback' => 'parallax_one_sanitize_text', 'default' => json_encode(array(array('image_url' => parallax_get_file('/images/team/1.jpg'), 'title' => esc_html__('Albert Jacobs', 'parallax-one'), 'subtitle' => esc_html__('Founder & CEO', 'parallax-one')), array('image_url' => parallax_get_file('/images/team/2.jpg'), 'title' => esc_html__('Tonya Garcia', 'parallax-one'), 'subtitle' => esc_html__('Account Manager', 'parallax-one')), array('image_url' => parallax_get_file('/images/team/3.jpg'), 'title' => esc_html__('Linda Guthrie', 'parallax-one'), 'subtitle' => esc_html__('Business Development', 'parallax-one'))))));
    $wp_customize->add_control(new Parallax_One_General_Repeater($wp_customize, 'parallax_one_team_content', array('label' => esc_html__('Add new team member', 'parallax-one'), 'section' => 'parallax_one_team_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 3, 'parallax_image_control' => true, 'parallax_title_control' => true, 'parallax_subtitle_control' => true)));
    /********************************************************/
    /********** TESTIMONIALS OPTIONS  ***********************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_testimonials_section', array('title' => esc_html__('Testimonial section', 'parallax-one'), 'priority' => 35));
    /* Testimonials title */
    $wp_customize->add_setting('parallax_one_happy_customers_title', array('default' => esc_html__('Happy Customers', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_happy_customers_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_testimonials_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1));
    /* Testimonials subtitle */
    $wp_customize->add_setting('parallax_one_happy_customers_subtitle', array('default' => esc_html__('Cloud computing subscription model out of the box proactive solution.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_happy_customers_subtitle', array('label' => esc_html__('Subtitle', 'parallax-one'), 'section' => 'parallax_one_testimonials_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    /* Testimonials content */
    $wp_customize->add_setting('parallax_one_testimonials_content', array('sanitize_callback' => 'parallax_one_sanitize_text', 'default' => json_encode(array(array('image_url' => parallax_get_file('/images/clients/1.jpg'), 'title' => esc_html__('Happy Customer', 'parallax-one'), 'subtitle' => esc_html__('Lorem ipsum', 'parallax-one'), 'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo. Fusce malesuada vulputate faucibus. Integer in hendrerit nisi. Praesent a hendrerit urna. In non imperdiet elit, sed molestie odio. Fusce ac metus non purus sollicitudin laoreet.', 'parallax-one')), array('image_url' => parallax_get_file('/images/clients/2.jpg'), 'title' => esc_html__('Happy Customer', 'parallax-one'), 'subtitle' => esc_html__('Lorem ipsum', 'parallax-one'), 'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo. Fusce malesuada vulputate faucibus. Integer in hendrerit nisi. Praesent a hendrerit urna. In non imperdiet elit, sed molestie odio. Fusce ac metus non purus sollicitudin laoreet.', 'parallax-one')), array('image_url' => parallax_get_file('/images/clients/3.jpg'), 'title' => esc_html__('Happy Customer', 'parallax-one'), 'subtitle' => esc_html__('Lorem ipsum', 'parallax-one'), 'text' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, consequat nibh. Etiam non elit dui. Nullam vel eros sit amet arcu vestibulum accumsan in in leo. Fusce malesuada vulputate faucibus. Integer in hendrerit nisi. Praesent a hendrerit urna. In non imperdiet elit, sed molestie odio. Fusce ac metus non purus sollicitudin laoreet.', 'parallax-one'))))));
    $wp_customize->add_control(new Parallax_One_General_Repeater($wp_customize, 'parallax_one_testimonials_content', array('label' => esc_html__('Add new testimonial', 'parallax-one'), 'section' => 'parallax_one_testimonials_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 3, 'parallax_image_control' => true, 'parallax_title_control' => true, 'parallax_subtitle_control' => true, 'parallax_text_control' => true)));
    /********************************************************/
    /***************** RIBBON OPTIONS  *****************/
    /********************************************************/
    /* RIBBON SETTINGS */
    $wp_customize->add_section('parallax_one_ribbon_section', array('title' => esc_html__('Ribbon section', 'parallax-one'), 'priority' => 36));
    /* Ribbon Background	*/
    $wp_customize->add_setting('paralax_one_ribbon_background', array('default' => parallax_get_file('/images/background-images/parallax-img/parallax-img1.jpg'), 'sanitize_callback' => 'esc_url', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'paralax_one_ribbon_background', array('label' => esc_html__('Ribbon Background', 'parallax-one'), 'section' => 'parallax_one_ribbon_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1)));
    $wp_customize->add_setting('parallax_one_ribbon_title', array('default' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_ribbon_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_ribbon_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    $wp_customize->add_setting('parallax_one_button_text', array('default' => esc_html__('GET STARTED', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_button_text', array('label' => esc_html__('Button label', 'parallax-one'), 'section' => 'parallax_one_ribbon_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 3));
    $wp_customize->add_setting('parallax_one_button_link', array('default' => esc_html__('#', 'parallax-one'), 'sanitize_callback' => 'esc_url', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_button_link', array('label' => esc_html__('Button link', 'parallax-one'), 'section' => 'parallax_one_ribbon_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 4));
    /********************************************************/
    /************ LATEST NEWS OPTIONS  **************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_latest_news_section', array('title' => esc_html__('Latest news section', 'parallax-one'), 'priority' => 36));
    $wp_customize->add_setting('parallax_one_latest_news_title', array('default' => esc_html__('Latest news', 'parallax-one'), 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_latest_news_title', array('label' => esc_html__('Main title', 'parallax-one'), 'section' => 'parallax_one_latest_news_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1));
    /********************************************************/
    /****************** CONTACT OPTIONS  ********************/
    /********************************************************/
    /* CONTACT SETTINGS */
    $wp_customize->add_section('parallax_one_contact_section', array('title' => esc_html__('Contact section', 'parallax-one'), 'priority' => 37));
    $wp_customize->add_setting('parallax_one_contact_info_content', array('sanitize_callback' => 'parallax_one_sanitize_text', 'default' => json_encode(array(array("icon_value" => "icon-basic-mail", "text" => "*****@*****.**", "link" => "#"), array("icon_value" => "icon-basic-geolocalize-01", "text" => "Company address", "link" => "#"), array("icon_value" => "icon-basic-tablet", "text" => "0 332 548 954", "link" => "#")))));
    $wp_customize->add_control(new Parallax_One_General_Repeater($wp_customize, 'parallax_one_contact_info_content', array('label' => esc_html__('Add new contact field', 'parallax-one'), 'section' => 'parallax_one_contact_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 1, 'parallax_image_control' => false, 'parallax_icon_control' => true, 'parallax_text_control' => true, 'parallax_link_control' => true)));
    /* Map ShortCode  */
    $wp_customize->add_setting('parallax_one_frontpage_map_shortcode', array('default' => '', 'sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control('parallax_one_frontpage_map_shortcode', array('label' => esc_html__('Map shortcode', 'parallax-one'), 'description' => __('To use this section please install <a href="https://wordpress.org/plugins/intergeo-maps/">Intergeo Maps</a> plugin then use it to create a map and paste here the shortcode generated', 'parallax-one'), 'section' => 'parallax_one_contact_section', 'active_callback' => 'parallax_one_show_on_front', 'priority' => 2));
    /********************************************************/
    /*************** CONTACT PAGE OPTIONS  ******************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_contact_page', array('title' => esc_html__('Contact page', 'parallax-one'), 'priority' => 39));
    /* Contact Form  */
    $wp_customize->add_setting('parallax_one_contact_form_shortcode', array('default' => '', 'sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control('parallax_one_contact_form_shortcode', array('label' => esc_html__('Contact form shortcode', 'parallax-one'), 'description' => __('Create a form, copy the shortcode generated and paste it here. We recommend <a href="https://wordpress.org/plugins/contact-form-7/">Contact Form 7</a> but you can use any plugin you like.', 'parallax-one'), 'section' => 'parallax_one_contact_page', 'active_callback' => 'parallax_one_is_contact_page', 'priority' => 1));
    /* Map ShortCode  */
    $wp_customize->add_setting('parallax_one_contact_map_shortcode', array('default' => '', 'sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control('parallax_one_contact_map_shortcode', array('label' => esc_html__('Map shortcode', 'parallax-one'), 'description' => __('To use this section please install <a href="https://wordpress.org/plugins/intergeo-maps/">Intergeo Maps</a> plugin then use it to create a map and paste here the shortcode generated', 'parallax-one'), 'section' => 'parallax_one_contact_page', 'active_callback' => 'parallax_one_is_contact_page', 'priority' => 2));
    /********************************************************/
    /****************** FOOTER OPTIONS  *********************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_footer_section', array('title' => esc_html__('Footer options', 'parallax-one'), 'priority' => 39, 'description' => esc_html__('The main content of this section is customizable in: Customize -> Widgets -> Footer area. ', 'parallax-one')));
    /* Footer Menu */
    $nav_menu_locations_footer = $wp_customize->get_control('nav_menu_locations[parallax_footer_menu]');
    if (!empty($nav_menu_locations_footer)) {
        $nav_menu_locations_footer->section = 'parallax_one_footer_section';
        $nav_menu_locations_footer->priority = 1;
    }
    /* Copyright */
    $wp_customize->add_setting('parallax_one_copyright', array('default' => 'Themeisle', 'sanitize_callback' => 'parallax_one_sanitize_text', 'transport' => 'postMessage'));
    $wp_customize->add_control('parallax_one_copyright', array('label' => esc_html__('Copyright', 'parallax-one'), 'section' => 'parallax_one_footer_section', 'priority' => 2));
    /* Socials icons */
    $wp_customize->add_setting('parallax_one_social_icons', array('sanitize_callback' => 'parallax_one_sanitize_text', 'default' => json_encode(array(array('icon_value' => 'icon-social-facebook', 'link' => '#'), array('icon_value' => 'icon-social-twitter', 'link' => '#'), array('icon_value' => 'icon-social-googleplus', 'link' => '#')))));
    $wp_customize->add_control(new Parallax_One_General_Repeater($wp_customize, 'parallax_one_social_icons', array('label' => esc_html__('Add new social icon', 'parallax-one'), 'section' => 'parallax_one_footer_section', 'priority' => 3, 'parallax_image_control' => false, 'parallax_icon_control' => true, 'parallax_text_control' => false, 'parallax_link_control' => true)));
    /********************************************************/
    /************** ADVANCED OPTIONS  ***********************/
    /********************************************************/
    $wp_customize->add_section('parallax_one_general_section', array('title' => esc_html__('Advanced options', 'parallax-one'), 'priority' => 40, 'description' => esc_html__('Paralax One theme general options', 'parallax-one')));
    $blogname = $wp_customize->get_control('blogname');
    $blogdescription = $wp_customize->get_control('blogdescription');
    $show_on_front = $wp_customize->get_control('show_on_front');
    $page_on_front = $wp_customize->get_control('page_on_front');
    $page_for_posts = $wp_customize->get_control('page_for_posts');
    if (!empty($blogname)) {
        $blogname->section = 'parallax_one_general_section';
        $blogname->priority = 1;
    }
    if (!empty($blogdescription)) {
        $blogdescription->section = 'parallax_one_general_section';
        $blogdescription->priority = 2;
    }
    if (!empty($show_on_front)) {
        $show_on_front->section = 'parallax_one_general_section';
        $show_on_front->priority = 3;
    }
    if (!empty($page_on_front)) {
        $page_on_front->section = 'parallax_one_general_section';
        $page_on_front->priority = 4;
    }
    if (!empty($page_for_posts)) {
        $page_for_posts->section = 'parallax_one_general_section';
        $page_for_posts->priority = 5;
    }
    $wp_customize->remove_section('static_front_page');
    $wp_customize->remove_section('title_tagline');
    $nav_menu_locations_primary = $wp_customize->get_control('nav_menu_locations[primary]');
    if (!empty($nav_menu_locations_primary)) {
        $nav_menu_locations_primary->section = 'parallax_one_general_section';
        $nav_menu_locations_primary->priority = 6;
    }
    /* Disable preloader */
    $wp_customize->add_setting('paralax_one_disable_preloader', array('sanitize_callback' => 'parallax_one_sanitize_text'));
    $wp_customize->add_control('paralax_one_disable_preloader', array('type' => 'checkbox', 'label' => esc_html__('Disable preloader?', 'parallax-one'), 'description' => esc_html__('If this box is checked, the preloader will be disabled from homepage.', 'parallax-one'), 'section' => 'parallax_one_general_section', 'priority' => 7));
}
Пример #27
0
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function semifolio_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    /**
    * Remove setting & control
    */
    $wp_customize->remove_setting('display_header_text');
    $wp_customize->remove_control('display_header_text');
    $wp_customize->remove_section('color');
    $wp_customize->remove_setting('header_textcolor');
    $wp_customize->remove_control('header_textcolor');
    /**
     * Textarea customize control class.
     */
    if (class_exists('WP_Customize_Control')) {
        class Semifolio_Customize_Textarea_Control extends WP_Customize_Control
        {
            public $type = 'textarea';
            public function render_content()
            {
                ?>
        <label>
            <span class="customize-control-title"><?php 
                echo esc_html($this->label);
                ?>
</span>
                <textarea rows= "5" style="width:100%;"<?php 
                $this->link();
                ?>
><?php 
                echo esc_textarea($this->value());
                ?>
</textarea>
        </label>
        <?php 
            }
        }
    }
    /**
     * Text attribute customize control class.
     */
    if (class_exists('WP_Customize_Control')) {
        class Semifolio_Customize_Info_Control extends WP_Customize_Control
        {
            public $type = 'info';
            public function render_content()
            {
                ?>
        <label>
            <span class="customize-control-title"><?php 
                echo esc_html($this->label);
                ?>
</span>
            <span <?php 
                $this->link();
                ?>
><?php 
                echo esc_attr($this->value());
                ?>
</span>
        </label>
    <?php 
            }
        }
    }
    /*----------------------------------------------------------------------------------------*/
    /* Blog Options. 
    /*----------------------------------------------------------------------------------------*/
    $wp_customize->add_section('semifolio_blog_options', array('title' => __('Blog Options', 'semifolio'), 'description' => '', 'priority' => 1));
    // Display Popular Post
    $wp_customize->add_setting('semifolio_display_popular_post_setting', array('default' => 0, 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'semifolio_sanitize_checkbox'));
    $wp_customize->add_control('popular_post', array('label' => __('Do You want to display popular post?', 'semifolio'), 'section' => 'semifolio_blog_options', 'settings' => 'semifolio_display_popular_post_setting', 'type' => 'checkbox', 'priority' => 1));
    // Display Slideshow
    $wp_customize->add_setting('semifolio_display_portfolio_setting', array('default' => 0, 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'semifolio_sanitize_checkbox'));
    $wp_customize->add_control('portfolio_post', array('settings' => 'semifolio_display_portfolio_setting', 'label' => __('Do You want to display portfolio post?', 'semifolio'), 'section' => 'semifolio_blog_options', 'type' => 'checkbox', 'priority' => 2));
    // Post Type Portfolio
    $wp_customize->add_setting('semifolio_posttype_portfolio', array('default' => 'page', 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'semifolio_sanitize_text_attribute'));
    $wp_customize->add_control(new Semifolio_Customize_Textarea_Control($wp_customize, 'posttype_portfolio', array('label' => __('Input post type just for custom post portfolio, separated by commas if use more than one of post type. This support post type from plugin installed. Example: ( default blog: "post", "page" )', 'semifolio'), 'section' => 'semifolio_blog_options', 'settings' => 'semifolio_posttype_portfolio', 'type' => 'textarea', 'priority' => 3)));
    /*----------------------------------------------------------------------------------------*/
    /* Layout Options Section 
    /*----------------------------------------------------------------------------------------*/
    $wp_customize->add_section('semifolio_layout_options', array('title' => __('Layout Options', 'semifolio'), 'description' => '', 'priority' => 2));
    // Display Favicon
    $wp_customize->add_setting('semifolio_display_favicon_icon', array('default' => 0, 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'semifolio_sanitize_checkbox'));
    $wp_customize->add_control('display_favicon_icon', array('settings' => 'semifolio_display_favicon_icon', 'label' => __('Do you want to display favicon?', 'semifolio'), 'section' => 'semifolio_layout_options', 'type' => 'checkbox', 'priority' => 1));
    // Upload Favicon Icon
    $wp_customize->add_setting('semifolio_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:', 'semifolio'), 'section' => 'semifolio_layout_options', 'settings' => 'semifolio_upload_favicon_icon', 'priority' => 2)));
    // Upload Header Ads Image
    $wp_customize->add_setting('semifolio_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:', 'semifolio'), 'section' => 'semifolio_layout_options', 'settings' => 'semifolio_upload_header_ads', 'priority' => 3)));
    // Header Ads URL
    $wp_customize->add_setting('semifolio_header_ads_url', array('default' => '', 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'semifolio_sanitize_text_attribute'));
    $wp_customize->add_control(new Semifolio_Customize_Textarea_Control($wp_customize, 'header_ads_url', array('label' => __('Input Full URL Header Ads', 'semifolio'), 'section' => 'semifolio_layout_options', 'settings' => 'semifolio_header_ads_url', 'type' => 'textarea', 'priority' => 4)));
    // Display Footer Widget
    $wp_customize->add_setting('semifolio_display_footer_widget', array('default' => 0, 'capability' => 'edit_theme_options', 'type' => 'option', 'transport' => 'postMessage', 'sanitize_callback' => 'semifolio_sanitize_checkbox'));
    $wp_customize->add_control('display_footer_widget', array('settings' => 'semifolio_display_footer_widget', 'label' => __('Do You want to display Footer Widget?', 'semifolio'), 'section' => 'semifolio_layout_options', 'type' => 'checkbox', 'priority' => 5));
    // Footer Tagline
    $wp_customize->add_setting('semifolio_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. <a href="' . esc_url(__('http://generasite.tk/', 'semifolio')) . '">Upgrade Now!</a>', 'semifolio') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'semifolio_sanitize_text_attribute'));
    $wp_customize->add_control(new Semifolio_Customize_Info_Control($wp_customize, 'footer_tagline', array('label' => __('Footer Bottom Tagline', 'semifolio'), 'section' => 'semifolio_layout_options', 'settings' => 'semifolio_footer_tagline', 'type' => 'info', 'priority' => 6)));
    /*----------------------------------------------------------------------------------------*/
    /* Images Resize Section 
    /*----------------------------------------------------------------------------------------*/
    $wp_customize->add_section('semifolio_images_resize_section', array('title' => __('Images Resize', 'semifolio'), 'description' => 'Semifolio PRO Support Only!', 'priority' => 3));
    // PRO Options
    $wp_customize->add_setting('semifolio_images_resize', array('default' => '' . __('Allows you to change the size of images in posts on every page of your blog. <a href="' . esc_url(__('http://generasite.tk/', 'semifolio')) . '">Upgrade Now!</a>', 'semifolio') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'semifolio_sanitize_text_attribute'));
    $wp_customize->add_control(new Semifolio_Customize_Info_Control($wp_customize, 'images_resize', array('label' => __('Semifolio PRO Options!', 'semifolio'), 'section' => 'semifolio_images_resize_section', 'settings' => 'semifolio_images_resize', 'type' => 'info')));
    /*----------------------------------------------------------------------------------------*/
    /* Background Color Section 
    /*----------------------------------------------------------------------------------------*/
    $wp_customize->add_section('semifolio_background_color_section', array('title' => __('Background Color', 'semifolio'), 'description' => 'Semifolio PRO Support Only!', 'priority' => 4));
    // PRO Options
    $wp_customize->add_setting('semifolio_background_color', array('default' => '' . __('Allows you to change the background in each area on your blog page. <a href="' . esc_url(__('http://generasite.tk/', 'semifolio')) . '">Upgrade Now!</a>', 'semifolio') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'semifolio_sanitize_text_attribute'));
    $wp_customize->add_control(new Semifolio_Customize_Info_Control($wp_customize, 'background_color', array('label' => __('Semifolio PRO Options!', 'semifolio'), 'section' => 'semifolio_background_color_section', 'settings' => 'semifolio_background_color', 'type' => 'info')));
    /*----------------------------------------------------------------------------------------*/
    /* Text & Links Color Section
    /*----------------------------------------------------------------------------------------*/
    $wp_customize->add_section('semifolio_text_color_section', array('title' => __('Texts & Links Color', 'semifolio'), 'description' => 'Semifolio PRO Support Only!', 'priority' => 5));
    // PRO Options
    $wp_customize->add_setting('semifolio_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. <a href="' . esc_url(__('http://generasite.tk/', 'semifolio')) . '">Upgrade Now!</a>', 'semifolio') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'semifolio_sanitize_text_attribute'));
    $wp_customize->add_control(new Semifolio_Customize_Info_Control($wp_customize, 'text_color', array('label' => __('Semifolio PRO Options!', 'semifolio'), 'section' => 'semifolio_text_color_section', 'settings' => 'semifolio_text_color', 'type' => 'info')));
    /*----------------------------------------------------------------------------------------*/
    /* Tracking Code, Script & CSS Section
    /*----------------------------------------------------------------------------------------*/
    $wp_customize->add_section('semifolio_code_section', array('title' => __('Tracking Code, Script & CSS', 'semifolio'), 'description' => 'Semifolio PRO Support Only!', 'priority' => 6));
    // PRO Options
    $wp_customize->add_setting('semifolio_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. <a href="' . esc_url(__('http://generasite.tk/', 'semifolio')) . '">Upgrade Now!</a>', 'semifolio') . '', 'transport' => 'postMessage', 'sanitize_callback' => 'semifolio_sanitize_text_attribute'));
    $wp_customize->add_control(new Semifolio_Customize_Info_Control($wp_customize, 'tracking_code', array('label' => __('Semifolio PRO Options!', 'semifolio'), 'section' => 'semifolio_code_section', 'settings' => 'semifolio_tracking_code', 'type' => 'info')));
}
Пример #28
0
/**
 * Briar Theme custom options
 *
 * @since 1.0
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function briar_customize_register($wp_customize)
{
    /**
     * Customizer additions.
     */
    require get_template_directory() . '/inc/customizer-functions.php';
    // Extra functions.
    require get_template_directory() . '/inc/customizer-controls.php';
    // Extra controls.
    // Remove Site title & tagline section.
    $wp_customize->remove_section('title_tagline');
    // Change site title and tagline controls transport to postMessage.
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    // Move site title and tagline controls to header section.
    $wp_customize->get_control('blogname')->section = 'header';
    $wp_customize->get_control('blogdescription')->section = 'header';
    // Remove preexisting controls.
    $wp_customize->remove_control('header_textcolor');
    /* -------		Header 		------- */
    $wp_customize->add_section('header', array('title' => __('Header', 'briar'), 'priority' => 29));
    $sanitize_header_choice = new Briar_Sanitize_Select(array('logo', 'title'), 'title');
    $wp_customize->add_setting('briar_header', array('default' => 'title', 'transport' => 'postMessage', 'sanitize_callback' => array($sanitize_header_choice, 'callback')));
    $wp_customize->add_control('briar_header', array('label' => __('Display', 'briar'), 'section' => 'header', 'type' => 'select', 'choices' => array('logo' => __('Logo', 'briar'), 'title' => __('Site Title', 'briar'))));
    $wp_customize->add_setting('briar_header_logo', array('default' => get_template_directory_uri() . '/img/themejack.png', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'briar_header_logo', array('label' => __('Upload a logo', 'briar'), 'section' => 'header')));
    $sections = $wp_customize->sections();
    /* -------		Colors 			------- */
    if (!isset($sections['colors'])) {
        $wp_customize->add_section('colors', array('title' => __('Colors', 'briar'), 'priority' => 40));
    }
    $wp_customize->add_setting('briar_custom_style', array('default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'briar_sanitize_text_trim'));
    $sanitize_scheme = new Briar_Sanitize_Select(array('custom', 'red', 'orange', 'yellow', 'blue', 'violet', 'green'), 'red');
    $wp_customize->add_setting('briar_scheme', array('default' => 'red', 'transport' => 'postMessage', 'sanitize_callback' => array($sanitize_scheme, 'callback')));
    $wp_customize->add_control(new Briar_Color_Scheme_Control($wp_customize, 'briar_scheme', array('label' => __('Color Scheme', 'briar'), 'schemes' => array('red' => array('label' => __('Red', 'briar'), 'color' => '#f15156', 'colors' => array('briar_anchor_color' => '#f15156', 'briar_header_color' => '#f15156', 'briar_logo_color' => '#f15156', 'briar_menu_color' => '#f15156', 'briar_footer_color' => '#f15156', 'briar_readmore_color' => '#f15156', 'briar_comments_button_color' => '#f15156', 'briar_comments_submit_button_color' => '#f15156', 'briar_title_hover_color' => '#f15156', 'briar_prev_next_posts_color' => '#f15156', 'briar_search_button_color' => '#f15156', 'briar_audio_color' => '#f15156', 'briar_gallery_arrows_color' => '#f15156', 'briar_blog_post_pagination_color' => '#f15156', 'briar_password_protected_button_color' => '#f15156')), 'orange' => array('label' => __('Orange', 'briar'), 'color' => '#e8813d', 'colors' => array('briar_anchor_color' => '#e8813d', 'briar_header_color' => '#e8813d', 'briar_logo_color' => '#e8813d', 'briar_menu_color' => '#e8813d', 'briar_footer_color' => '#e8813d', 'briar_readmore_color' => '#e8813d', 'briar_comments_button_color' => '#e8813d', 'briar_comments_submit_button_color' => '#e8813d', 'briar_title_hover_color' => '#e8813d', 'briar_prev_next_posts_color' => '#e8813d', 'briar_search_button_color' => '#e8813d', 'briar_audio_color' => '#e8813d', 'briar_gallery_arrows_color' => '#e8813d', 'briar_blog_post_pagination_color' => '#e8813d', 'briar_password_protected_button_color' => '#e8813d')), 'yellow' => array('label' => __('Yellow', 'briar'), 'color' => '#f5d13d', 'colors' => array('briar_anchor_color' => '#f5d13d', 'briar_header_color' => '#f5d13d', 'briar_logo_color' => '#f5d13d', 'briar_menu_color' => '#f5d13d', 'briar_footer_color' => '#f5d13d', 'briar_readmore_color' => '#f5d13d', 'briar_comments_button_color' => '#f5d13d', 'briar_comments_submit_button_color' => '#f5d13d', 'briar_title_hover_color' => '#f5d13d', 'briar_prev_next_posts_color' => '#f5d13d', 'briar_search_button_color' => '#f5d13d', 'briar_audio_color' => '#f5d13d', 'briar_gallery_arrows_color' => '#f5d13d', 'briar_blog_post_pagination_color' => '#f5d13d', 'briar_password_protected_button_color' => '#f5d13d')), 'blue' => array('label' => __('Blue', 'briar'), 'color' => '#2980b9', 'colors' => array('briar_anchor_color' => '#2980b9', 'briar_header_color' => '#2980b9', 'briar_logo_color' => '#2980b9', 'briar_menu_color' => '#2980b9', 'briar_footer_color' => '#2980b9', 'briar_readmore_color' => '#2980b9', 'briar_comments_button_color' => '#2980b9', 'briar_comments_submit_button_color' => '#2980b9', 'briar_title_hover_color' => '#2980b9', 'briar_prev_next_posts_color' => '#2980b9', 'briar_search_button_color' => '#2980b9', 'briar_audio_color' => '#2980b9', 'briar_gallery_arrows_color' => '#2980b9', 'briar_blog_post_pagination_color' => '#2980b9', 'briar_password_protected_button_color' => '#2980b9')), 'violet' => array('label' => __('Violet', 'briar'), 'color' => '#b365d3', 'colors' => array('briar_anchor_color' => '#b365d3', 'briar_header_color' => '#b365d3', 'briar_logo_color' => '#b365d3', 'briar_menu_color' => '#b365d3', 'briar_footer_color' => '#b365d3', 'briar_readmore_color' => '#b365d3', 'briar_comments_button_color' => '#b365d3', 'briar_comments_submit_button_color' => '#b365d3', 'briar_title_hover_color' => '#b365d3', 'briar_prev_next_posts_color' => '#b365d3', 'briar_search_button_color' => '#b365d3', 'briar_audio_color' => '#b365d3', 'briar_gallery_arrows_color' => '#b365d3', 'briar_blog_post_pagination_color' => '#b365d3', 'briar_password_protected_button_color' => '#b365d3')), 'green' => array('label' => __('Green', 'briar'), 'color' => '#27ae60', 'colors' => array('briar_anchor_color' => '#27ae60', 'briar_header_color' => '#27ae60', 'briar_logo_color' => '#27ae60', 'briar_menu_color' => '#27ae60', 'briar_footer_color' => '#27ae60', 'briar_readmore_color' => '#27ae60', 'briar_comments_button_color' => '#27ae60', 'briar_comments_submit_button_color' => '#27ae60', 'briar_title_hover_color' => '#27ae60', 'briar_prev_next_posts_color' => '#27ae60', 'briar_search_button_color' => '#27ae60', 'briar_audio_color' => '#27ae60', 'briar_gallery_arrows_color' => '#27ae60', 'briar_blog_post_pagination_color' => '#27ae60', 'briar_password_protected_button_color' => '#27ae60'))), 'section' => 'colors')));
    $wp_customize->add_setting('briar_anchor_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_anchor_color', array('label' => __('Anchor', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_header_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_header_color', array('label' => __('Header', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_logo_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_logo_color', array('label' => __('Logo', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_menu_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_menu_color', array('label' => __('Menu', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_footer_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_footer_color', array('label' => __('Footer', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_readmore_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_readmore_color', array('label' => __('Read more', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_comments_button_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_comments_button_color', array('label' => __('Comments button', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_comments_submit_button_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_comments_submit_button_color', array('label' => __('Comments submit', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_title_hover_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_title_hover_color', array('label' => __('Comments submit', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_prev_next_posts_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_prev_next_posts_color', array('label' => __('Older/Newer posts', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_search_button_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_search_button_color', array('label' => __('Search button', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_audio_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_audio_color', array('label' => __('Audio', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_gallery_arrows_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_gallery_arrows_color', array('label' => __('Gallery arrows', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_blog_post_pagination_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_blog_post_pagination_color', array('label' => __('Post pagination', 'briar'), 'section' => 'colors')));
    $wp_customize->add_setting('briar_password_protected_button_color', array('default' => '#f15156', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'briar_password_protected_button_color', array('label' => __('Password protected button', 'briar'), 'section' => 'colors')));
    /* -------		Layouts 		------- */
    $wp_customize->add_section('layouts', array('title' => __('Layouts', 'briar'), 'priority' => 40));
    $sanitize_global_layouts = new Briar_Sanitize_Select(array('none', 'left', 'right'), 'left');
    $sanitize_layouts = new Briar_Sanitize_Select(array('disabled', 'none', 'left', 'right'), 'disabled');
    $wp_customize->add_setting('briar_global_layout', array('default' => 'left', 'transport' => 'postMessage', 'sanitize_callback' => array($sanitize_global_layouts, 'callback')));
    $wp_customize->add_control(new Briar_Layout_Control($wp_customize, 'briar_global_layout', array('label' => __('Global', 'briar'), 'section' => 'layouts', 'layouts' => array('none' => array('label' => __('None', 'briar')), 'left' => array('label' => __('Left', 'briar')), 'right' => array('label' => __('Right', 'briar'))), 'priority' => 1)));
    $wp_customize->add_setting('briar_home_layout', array('default' => 'disabled', 'transport' => 'postMessage', 'sanitize_callback' => array($sanitize_layouts, 'callback')));
    $wp_customize->add_control(new Briar_Layout_Control($wp_customize, 'briar_home_layout', array('label' => __('Home', 'briar'), 'section' => 'layouts', 'layouts' => array('disabled' => array('label' => __('Disabled', 'briar')), 'none' => array('label' => __('None', 'briar')), 'left' => array('label' => __('Left', 'briar')), 'right' => array('label' => __('Right', 'briar'))), 'priority' => 2)));
    $wp_customize->add_setting('briar_blog_layout', array('default' => 'disabled', 'transport' => 'postMessage', 'sanitize_callback' => array($sanitize_layouts, 'callback')));
    $wp_customize->add_control(new Briar_Layout_Control($wp_customize, 'briar_blog_layout', array('label' => __('Blog', 'briar'), 'section' => 'layouts', 'layouts' => array('disabled' => array('label' => __('Disabled', 'briar')), 'none' => array('label' => __('None', 'briar')), 'left' => array('label' => __('Left', 'briar')), 'right' => array('label' => __('Right', 'briar'))), 'priority' => 3)));
    $wp_customize->add_setting('briar_single_layout', array('default' => 'disabled', 'transport' => 'postMessage', 'sanitize_callback' => array($sanitize_layouts, 'callback')));
    $wp_customize->add_control(new Briar_Layout_Control($wp_customize, 'briar_single_layout', array('label' => __('Single', 'briar'), 'section' => 'layouts', 'layouts' => array('disabled' => array('label' => __('Disabled', 'briar')), 'none' => array('label' => __('None', 'briar')), 'left' => array('label' => __('Left', 'briar')), 'right' => array('label' => __('Right', 'briar'))), 'priority' => 4)));
    $wp_customize->add_setting('briar_archive_layout', array('default' => 'disabled', 'transport' => 'postMessage', 'sanitize_callback' => array($sanitize_layouts, 'callback')));
    $wp_customize->add_control(new Briar_Layout_Control($wp_customize, 'briar_archive_layout', array('label' => __('Archive', 'briar'), 'section' => 'layouts', 'layouts' => array('disabled' => array('label' => __('Disabled', 'briar')), 'none' => array('label' => __('None', 'briar')), 'left' => array('label' => __('Left', 'briar')), 'right' => array('label' => __('Right', 'briar'))), 'priority' => 5)));
    $wp_customize->add_setting('briar_category_archive_layout', array('default' => 'disabled', 'transport' => 'postMessage', 'sanitize_callback' => array($sanitize_layouts, 'callback')));
    $wp_customize->add_control(new Briar_Layout_Control($wp_customize, 'briar_category_archive_layout', array('label' => __('Category archive', 'briar'), 'section' => 'layouts', 'layouts' => array('disabled' => array('label' => __('Disabled', 'briar')), 'none' => array('label' => __('None', 'briar')), 'left' => array('label' => __('Left', 'briar')), 'right' => array('label' => __('Right', 'briar'))), 'priority' => 6)));
    $wp_customize->add_setting('briar_search_layout', array('default' => 'disabled', 'transport' => 'postMessage', 'sanitize_callback' => array($sanitize_layouts, 'callback')));
    $wp_customize->add_control(new Briar_Layout_Control($wp_customize, 'briar_search_layout', array('label' => __('Search', 'briar'), 'section' => 'layouts', 'layouts' => array('disabled' => array('label' => __('Disabled', 'briar')), 'none' => array('label' => __('None', 'briar')), 'left' => array('label' => __('Left', 'briar')), 'right' => array('label' => __('Right', 'briar'))), 'priority' => 7)));
    $wp_customize->add_setting('briar_404_layout', array('default' => 'disabled', 'transport' => 'postMessage', 'sanitize_callback' => array($sanitize_layouts, 'callback')));
    $wp_customize->add_control(new Briar_Layout_Control($wp_customize, 'briar_404_layout', array('label' => __('404', 'briar'), 'section' => 'layouts', 'layouts' => array('disabled' => array('label' => __('Disabled', 'briar')), 'none' => array('label' => __('None', 'briar')), 'left' => array('label' => __('Left', 'briar')), 'right' => array('label' => __('Right', 'briar'))), 'priority' => 8)));
    $wp_customize->add_setting('briar_page_layout', array('default' => 'disabled', 'transport' => 'postMessage', 'sanitize_callback' => array($sanitize_layouts, 'callback')));
    $wp_customize->add_control(new Briar_Layout_Control($wp_customize, 'briar_page_layout', array('label' => __('Default Page', 'briar'), 'section' => 'layouts', 'layouts' => array('disabled' => array('label' => __('Disabled', 'briar')), 'none' => array('label' => __('None', 'briar')), 'left' => array('label' => __('Left', 'briar')), 'right' => array('label' => __('Right', 'briar'))), 'priority' => 9)));
    /* -------		Background 		------- */
    $wp_customize->get_control('background_color')->section = 'background_image';
    $wp_customize->get_section('background_image')->title = __('Background', 'briar');
    /* -------		Header 		------- */
    $wp_customize->add_section('footer', array('title' => __('Footer', 'briar'), 'priority' => 29));
    $wp_customize->add_setting('briar_footer_social_buttons', array('default' => array(array('social' => 'facebook', 'css_class' => 'facebook', 'url' => '#'), array('social' => 'twitter', 'css_class' => 'twitter', 'url' => '#'), array('social' => 'linkedin', 'css_class' => 'linkedin', 'url' => '#')), 'transport' => 'postMessage', 'sanitize_callback' => 'briar_sanitize_social_buttons'));
    $wp_customize->add_control(new Briar_Social_Buttons_Control($wp_customize, 'briar_footer_social_buttons', array('label' => __('Social buttons', 'briar'), 'socials' => array('facebook' => array('label' => __('Facebook', 'briar')), 'twitter' => array('label' => __('Twitter', 'briar')), 'linkedin' => array('label' => __('LinkedIn', 'briar')), 'dribbble' => array('label' => __('Dribbble', 'briar')), 'flickr' => array('label' => __('Flickr', 'briar')), 'github' => array('label' => __('GitHub', 'briar')), 'googleplus' => array('label' => __('Google+', 'briar')), 'instagram' => array('label' => __('Instagram', 'briar')), 'pinterest' => array('label' => __('Pinterest', 'briar')), 'stumbleupon' => array('label' => __('StumbleUpon', 'briar')), 'skype' => array('label' => __('Skype', 'briar')), 'tumblr' => array('label' => __('Tumblr', 'briar')), 'vimeo' => array('label' => __('Vimeo', 'briar')), 'behance' => array('label' => __('Behance', 'briar'))), 'section' => 'footer')));
    /* -------		Front 	 		------- */
    $wp_customize->get_section('static_front_page')->title = __('Front', 'briar');
}
Пример #29
-1
/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function gently_customize_register($wp_customize)
{
    if (class_exists('Kirki')) {
        $wp_customize->add_section('color', array('title' => __('Color', 'gently'), 'priority' => 81));
        $wp_customize->add_section('typography', array('title' => __('Typography', 'gently'), 'priority' => 82));
        $wp_customize->add_section('header', array('title' => __('Top bar', 'gently'), 'priority' => 91));
        $wp_customize->add_section('sidebar', array('title' => __('Sidebar', 'gently'), 'priority' => 101));
        $wp_customize->add_section('footer', array('title' => __('Footer', 'gently'), 'priority' => 111));
        $wp_customize->add_section('social', array('title' => __('Social Media', 'gently'), 'priority' => 112, 'description' => __('Share buttons will be displayed under each single post.', 'gently')));
        if (function_exists('mc4wp_show_form')) {
            $wp_customize->add_section('newsletter', array('title' => __('Newsletter', 'gently'), 'priority' => 113));
        }
        // Rename default section
        $background_section = $wp_customize->get_section('background_image');
        $background_section->title = __('Background', 'gently');
        // Move background color to custom section
        $background_color_control = $wp_customize->get_control('background_color');
        $background_color_control->section = 'background_image';
        // Change blogname setting transport to post, description and title
        $blogname_setting = $wp_customize->get_setting('blogname');
        $blogname_setting->transport = 'postMessage';
        $blogname_controll = $wp_customize->get_control('blogname');
        $blogname_controll->description = __('If you want to use text version of logo remove images above.', 'gently');
        // Change Header image section order
        $header_image_section = $wp_customize->get_section('header_image');
        $header_image_section->priority = 99;
        // Remove unused header text and text color controls
        $wp_customize->remove_control('display_header_text');
        $wp_customize->remove_control('header_textcolor');
        // Remove tagline field
        $wp_customize->remove_setting('blogdescription');
        $wp_customize->remove_control('blogdescription');
    } else {
        // Convert default section to a notice that inform user about more options in customzier when they install Kirki plugin.
        $wp_customize->add_section('notice', array('title' => __('Install Kirki for more options.', 'gently'), 'priority' => 1, 'description' => __('This theme uses free plugin from wordpress.org - Kirki. Install it to use many customizer options that comes with this theme.', 'gently')));
        $wp_customize->add_setting('install_notice', array('default' => '', 'sanitize_callback' => 'esc_url_raw'));
        $wp_customize->add_control('install_notice', array('section' => 'notice', 'label' => '', 'type' => ''));
    }
}
Пример #30
-1
 /**
  * Register header settings.
  *
  * @since 1.0.0
  *
  * @param WP_Customize_Manager $wp_customize Theme Customizer object.
  */
 function kihon_customize_register_header($wp_customize)
 {
     /**
      * Configure some WP default settings to fit this section.
      */
     $wp_customize->get_section('title_tagline')->title = 'Site Header';
     // $wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
     // Move header image control to title_tagline because it belongs together
     $wp_customize->get_control('header_image')->section = 'title_tagline';
     $wp_customize->get_control('header_image')->priority = 11;
     // Header Text Color changed to site title color
     $wp_customize->get_control('header_textcolor')->label = 'Site Title Color';
     // Remove site tagline because this theme doesn't support it front end
     // $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
     $wp_customize->remove_control('blogdescription');
     // $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
     // Custom settings and controls
     $wp_customize->add_setting('kihon_site_header_height', array('default' => 80, 'sanitize_callback' => 'kihon_sanitize_integer'));
     $wp_customize->add_control('kihon_site_header_height', array('label' => __('Site Header Height (px)', 'kihon'), 'section' => 'title_tagline', 'type' => 'text'));
     $wp_customize->add_setting('kihon_site_header_fixed', array('default' => 'on', 'sanitize_callback' => 'kihon_sanitize_radio_or_select'));
     $wp_customize->add_control('kihon_site_header_fixed', array('label' => __('Fixed Header?', 'kihon'), 'description' => __('Fix header to top when scrolled down.', 'kihon'), 'section' => 'title_tagline', 'type' => 'select', 'choices' => array('on' => __('On', 'kihon'), 'off' => __('Off', 'kihon'))));
 }