当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_Customize_Manager::add_control方法代码示例

本文整理汇总了PHP中WP_Customize_Manager::add_control方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Customize_Manager::add_control方法的具体用法?PHP WP_Customize_Manager::add_control怎么用?PHP WP_Customize_Manager::add_control使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Customize_Manager的用法示例。


在下文中一共展示了WP_Customize_Manager::add_control方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register

 /**
  * 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
  * @link http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/
  * @since ProGo 0.4
  */
 public static function register($wp_customize)
 {
     // Page Layout Settings
     $wp_customize->add_section('pgb_options[layout]', array('title' => 'ProGo Layout and Options', 'priority' => 10, 'description' => ''));
     $wp_customize->add_setting('pgb_options[container_width]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_container_width')));
     $wp_customize->add_setting('pgb_options[bootstrap_theme]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_bootstrap_theme')));
     $wp_customize->add_control('pgb_options[container_width]', array('label' => __('Page Container Width', 'pgb'), 'section' => 'pgb_options[layout]', 'settings' => 'pgb_options[container_width]', 'type' => 'select', 'choices' => array('full' => 'Full Width (100%)', '1366' => '1366px', '1240' => '1240px', '1170' => '1170px', '1080' => '1080px', '960' => '960px')));
     $wp_customize->add_control('pgb_options[bootstrap_theme]', array('label' => __('Bootstrap Theme', 'pgb'), 'section' => 'pgb_options[layout]', 'settings' => 'pgb_options[bootstrap_theme]', 'type' => 'select', 'choices' => array('default' => 'Default Bootstrap', 'cerulean' => 'Cerulean', 'cosmo' => 'Cosmo', 'cyborg' => 'Cyborg', 'darkly' => 'Darkly', 'flatly' => 'Flatly', 'journal' => 'Journal', 'lumen' => 'Lumen', 'paper' => 'Paper', 'readable' => 'Readable', 'sandstone' => 'Sandstone', 'simplex' => 'Simplex', 'slate' => 'Slate', 'spacelab' => 'Spacelab', 'superhero' => 'Superhero', 'united' => 'United', 'yeti' => 'Yeti')));
     // Logo Settings
     $wp_customize->add_section('pgb_options[logo]', array('title' => 'Logos', 'priority' => 30, 'description' => ''));
     $wp_customize->add_setting('pgb_options[logo_mobile]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_logo')));
     $wp_customize->add_setting('pgb_options[logo_tablet]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_logo')));
     $wp_customize->add_setting('pgb_options[logo_desktop]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_logo')));
     $wp_customize->add_control(new WP_Customize_Upload_Control($wp_customize, 'pgb_options[logo_mobile]', array('label' => __('Navbar Icon / Mobile Logo', 'pgb'), 'section' => 'pgb_options[logo]', 'settings' => 'pgb_options[logo_mobile]', 'description' => 'Add your logo to the Bootstrap <a href="http://getbootstrap.com/components/#navbar-brand-image" target="_blank">Brand Image</a> position. Displayed on screens under 768px wide.')));
     $wp_customize->add_control(new WP_Customize_Upload_Control($wp_customize, 'pgb_options[logo_tablet]', array('label' => __('Tablet Logo', 'pgb'), 'section' => 'pgb_options[logo]', 'settings' => 'pgb_options[logo_tablet]', 'description' => 'Tablet logo is displayed on screens 768px to 1024px wide.')));
     $wp_customize->add_control(new WP_Customize_Upload_Control($wp_customize, 'pgb_options[logo_desktop]', array('label' => __('Desktop Logo', 'pgb'), 'section' => 'pgb_options[logo]', 'settings' => 'pgb_options[logo_desktop]', 'description' => 'Desktop Logo is displayed on screen above 1024px wide.')));
     // Nav Settings
     $wp_customize->add_setting('pgb_options[menu_align]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_menu_align')));
     $wp_customize->add_setting('pgb_options[nav_position]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_nav_position')));
     $wp_customize->add_setting('pgb_options[nav_search]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_nav_search')));
     $wp_customize->add_control('pgb_options[menu_align]', array('label' => __('Main Menu Alignment', 'pgb'), 'section' => 'nav', 'settings' => 'pgb_options[menu_align]', 'type' => 'radio', 'choices' => array('right' => 'Right', 'left' => 'Left')));
     $wp_customize->add_control('pgb_options[nav_position]', array('label' => __('Main Navbar Position', 'pgb'), 'section' => 'nav', 'settings' => 'pgb_options[nav_position]', 'type' => 'radio', 'choices' => array('static' => 'Static', 'fixed' => 'Fixed')));
     $wp_customize->add_control('pgb_options[nav_search]', array('label' => __('Show Search in Main Navbar', 'pgb'), 'section' => 'nav', 'settings' => 'pgb_options[nav_search]', 'type' => 'checkbox', 'value' => 1, 'description' => 'Adds search field to the far right of the navbar'));
     // Footer Settings
     $wp_customize->add_section('pgb_options[footer]', array('title' => 'Footer', 'priority' => 130, 'description' => ''));
     $wp_customize->add_setting('pgb_options[footer_show]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_footer_show')));
     $wp_customize->add_setting('pgb_options[footer_columns]', array('type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'sanitize_callback' => array('ProGo_Customize', 'sanitize_footer_columns')));
     $wp_customize->add_control('pgb_options[footer_show]', array('label' => __('Show Footer Widgets', 'pgb'), 'section' => 'pgb_options[footer]', 'settings' => 'pgb_options[footer_show]', 'type' => 'checkbox', 'value' => '1'));
     $wp_customize->add_control('pgb_options[footer_columns]', array('label' => __('Number of Columns', 'pgb'), 'section' => 'pgb_options[footer]', 'settings' => 'pgb_options[footer_columns]', 'type' => 'select', 'choices' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4')));
 }
开发者ID:konamax123,项目名称:pgb,代码行数:42,代码来源:class.pgb_customizer.php

示例2: pure_customize_register

/**
 * Add postMessage support for site title and description for the Customizer.
 *
 * @since Pure 1.0
 *
 * @param WP_Customize_Manager $wp_customize Customizer object.
 */
function pure_customize_register($wp_customize)
{
    // Add postMessage support for site title and description.
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    /* 个人简介 */
    $wp_customize->add_section('pure_profile_options', array('title' => __('Profile', 'pure'), 'description' => __('Add profile here. This may be shown publicly', 'pure'), 'priority' => 25));
    // 是否显示
    $wp_customize->add_setting('pure_profile_show_on', array('default' => get_option('pure_profile_show_on', 'off'), 'sanitize_callback' => 'pure_sanitize_show_on'));
    $wp_customize->add_control('pure_profile_show_on', array('label' => __('Front page displays', 'pure'), 'section' => 'pure_profile_options', 'type' => 'radio', 'choices' => array('on' => __('Show on', 'pure'), 'off' => __('Show off', 'pure'))));
    // 邮箱
    $wp_customize->add_setting('pure_profile_email', array('default' => '', 'sanitize_callback' => 'pure_sanitize_email'));
    $wp_customize->add_control('pure_profile_email', array('label' => __('Email address', 'pure'), 'section' => 'pure_profile_options', 'type' => 'text'));
    // 昵称
    $wp_customize->add_setting('pure_profile_nickname', array('default' => '', 'sanitize_callback' => 'pure_sanitize_nohtml'));
    $wp_customize->add_control('pure_profile_nickname', array('label' => __('Nickname', 'pure'), 'section' => 'pure_profile_options', 'type' => 'text'));
    // 简介
    $wp_customize->add_setting('pure_profile_description', array('default' => '', 'sanitize_callback' => 'pure_sanitize_nohtml'));
    $wp_customize->add_control('pure_profile_description', array('label' => __('Description', 'pure'), 'section' => 'pure_profile_options', 'type' => 'textarea'));
    /* copyright */
    $wp_customize->add_section('pure_copyright_options', array('title' => __('Copyright', 'pure'), 'description' => __('Add copyright here. This may be shown publicly', 'pure'), 'priority' => 25));
    // 备案号
    $wp_customize->add_setting('pure_copyright_icp', array('default' => '', 'sanitize_callback' => 'pure_sanitize_nohtml'));
    $wp_customize->add_control('pure_copyright_icp', array('label' => __('ICP Licensing', 'pure'), 'section' => 'pure_copyright_options', 'type' => 'text'));
}
开发者ID:icodechef,项目名称:Pure,代码行数:32,代码来源:customizer.php

示例3: govpress_customize_register

/**
 * Add additional options and postMessage support to the customizer
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function govpress_customize_register($wp_customize)
{
    $wp_customize->add_setting('govpress[header_taglinecolor]', array('default' => '#222222', 'type' => 'option'));
    if (get_theme_mod('header_textcolor') !== 'blank') {
        $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_tagline_color', array('label' => __('Header Tagline Color', 'govpress'), 'section' => 'colors', 'settings' => 'govpress[header_taglinecolor]')));
    }
    // $wp_customize->add_setting( 'govpress[primary_color]', array(
    // 	'default' => '#0072BC',
    // 	'type' => 'option'
    // ) );
    // $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color', array(
    // 	'label' => __( 'Primary Color', 'govpress' ),
    // 	'section' => 'colors',
    // 	'settings' => 'govpress[primary_color]'
    // ) ) );
    $wp_customize->add_setting('govpress[primary_link_color]', array('default' => '#428BCA', 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'primary_link_color', array('label' => __('Primary Link Color', 'govpress'), 'section' => 'colors', 'settings' => 'govpress[primary_link_color]')));
    $wp_customize->add_setting('govpress[primary_link_hover]', array('default' => '#0072BC', 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'primary_link_hover', array('label' => __('Primary Link Hover', 'govpress'), 'section' => 'colors', 'settings' => 'govpress[primary_link_hover]')));
    $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_setting('header_taglinecolor')->transport = 'postMessage';
    // $wp_customize->get_setting( 'govpress[primary_color]' )->transport = 'postMessage';
    $wp_customize->get_setting('govpress[primary_link_color]')->transport = 'postMessage';
    $wp_customize->get_setting('govpress[primary_link_hover]')->transport = 'postMessage';
}
开发者ID:HeliWang,项目名称:EngSoc-Website,代码行数:32,代码来源:customizer.php

示例4: register

 /**
  * 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
  * @link http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes
  */
 public static function register($wp_customize)
 {
     //2. Register new settings to the WP database...
     $wp_customize->add_setting('highlight_color', array('default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
     //3. Finally, we define the control itself (which links a setting to a section and renders the HTML controls)...
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'mytheme_highlight_color', array('label' => __('Highlight Color', 'historias'), 'section' => 'colors', 'settings' => 'highlight_color', 'priority' => 10)));
     $wp_customize->add_setting('site_logo', array('type' => 'theme_mod', 'default' => get_template_directory_uri() . '/images/setoriais_logo.png'));
     $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'upload_site_logo', array('label' => __('Site Logo', 'historias'), 'section' => 'title_tagline', 'settings' => 'site_logo', 'priority' => 10)));
     $wp_customize->add_setting('site_tagline', array('default' => 'Eleição 2015', 'type' => 'option'));
     $wp_customize->add_control('site_tagline', array('type' => 'textarea', 'section' => 'title_tagline', 'label' => __('Tagline', 'historias')));
     //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('header_textcolor')->transport = 'postMessage';
     $wp_customize->get_setting('background_color')->transport = 'postMessage';
     // $wp_customize->add_section('setorial_cnpc_logo_section', array(
     //     'title'    => __('Logo', 'setorial_cnpc'),
     //     'description' => '',
     //     'priority' => 40,
     // ));
     // $wp_customize->add_setting('setorial_cnpc_logo]', array(
     //     'capability'        => 'edit_theme_options',
     //     'type'           => 'theme_mod',
     //     'default'  =>  get_template_directory_uri() . '/images/setoriais_logo.png',
     // ));
     // $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'setorial_cnpc_logo', array(
     //     'label'    => __('Imagem da logo', 'setorial_cnpc'),
     //     'section'  => 'setorial_cnpc_logo_section',
     //     'settings' => 'setorial_cnpc_logo',
     // )));
 }
开发者ID:CoordCulturaDigital-Minc,项目名称:eleicoescnpc,代码行数:42,代码来源:customizr.php

示例5: undiscovered_customize_register

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function undiscovered_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    // Logo upload
    $wp_customize->add_section('undiscovered_logotype', array('title' => __('Logotype', 'undiscovered'), 'priority' => 30, 'description' => 'Upload a logo to replace the default site name in the header'));
    $wp_customize->add_setting('undiscovered_options[logotype]', array('capability' => 'edit_theme_options', 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logotype', array('label' => __('Logo', 'undiscovered'), 'section' => 'undiscovered_logotype', 'settings' => 'undiscovered_options[logotype]')));
    // Fonts
    $wp_customize->add_section('undiscovered_fonts', array('title' => __('Fonts', 'undiscovered'), 'priority' => 30, 'description' => 'Set main website font'));
    $wp_customize->add_setting('undiscovered_options[font]', array('capability' => 'edit_theme_options', 'default' => 'Rokkit', 'type' => 'option'));
    $wp_customize->add_control('font', array('settings' => 'undiscovered_options[font]', 'label' => __('Fonts', 'undiscovered'), 'section' => 'undiscovered_fonts', 'type' => 'select', 'choices' => array('Rokkitt' => 'Rokkitt', 'Kameron' => 'Kameron', 'Abel' => 'Abel', 'Alice' => 'Alice', 'Andada' => 'Andada', 'Arbutus+Slab' => 'Arbutus Slab', 'Arvo' => 'Arvo', 'Brawler' => 'Brawler', 'Cambo' => 'Cambo', 'Cookie' => 'Cookie', 'Droid+Serif' => 'Droid Serif', 'Fenix' => 'Fenix', 'Judson' => 'Judson', 'Ledger' => 'Ledger', 'Libre+Baskerville' => 'Libre Baskerville', 'Lora' => 'Lora', 'Mako' => 'Mako', 'Marck+Script' => 'Marck Script', 'Maven+Pro' => 'Maven Pro', 'Neuton' => 'Neuton', 'Ovo' => 'Ovo', 'PT+Serif+Caption' => 'PT Serif Caption')));
    // Colors
    $wp_customize->add_section('undiscovered_colors', array('title' => __('Colors', 'undiscovered'), 'priority' => 40));
    // Primary
    $wp_customize->add_setting('undiscovered_options[primary_color]', array('default' => 'e83d52', 'sanitize_callback' => 'sanitize_hex_color', 'capability' => 'edit_theme_options', 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'primary_color', array('label' => __('Primary color', 'undiscovered'), 'section' => 'undiscovered_colors', 'settings' => 'undiscovered_options[primary_color]')));
    // Secondary
    $wp_customize->add_setting('undiscovered_options[secondary_color]', array('default' => 'be3243', 'sanitize_callback' => 'sanitize_hex_color', 'capability' => 'edit_theme_options', 'type' => 'option'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'secondary_color', array('label' => __('Secondary color', 'undiscovered'), 'section' => 'undiscovered_colors', 'settings' => 'undiscovered_options[secondary_color]')));
    // Social icons
    $wp_customize->add_section('undiscovered_social', array('title' => __('Social icons', 'undiscovered'), 'priority' => 30, 'description' => 'Leave blank if don\'t needed'));
    $networks = get_social_networks();
    foreach ($networks as $network) {
        $wp_customize->add_setting('undiscovered_options[social_' . strtolower($network) . ']', array('capability' => 'edit_theme_options', 'type' => 'option'));
        $wp_customize->add_control('undiscovered_options[social_' . strtolower($network) . ']', array('label' => $network, 'section' => 'undiscovered_social', 'type' => 'text'));
    }
}
开发者ID:ricofreak,项目名称:wordPressBlog,代码行数:33,代码来源:customizer.php

示例6: customizer

 /**
  * Register Customizer routine.
  *
  * @param \WP_Customize_Manager $wp_customize Manager.
  */
 public function customizer(WP_Customize_Manager $wp_customize)
 {
     if (!isset($wp_customize->selective_refresh)) {
         return;
     }
     $wp_customize->add_panel('wpsc', array('title' => __('Store', 'wp-e-commerce'), 'description' => __('Presentational settings for your store.', 'wp-e-commerce'), 'priority' => 150));
     foreach ($this->sections as $name => $label) {
         $wp_customize->add_section($name, array('title' => $label, 'panel' => 'wpsc'));
     }
     foreach ($this->settings as $name => $settings) {
         $wp_customize->add_setting($name, $settings['setting']);
         if (isset($settings['control']['class']) && 'WP_Customize_Control' === get_parent_class($settings['control']['class'])) {
             $class = $settings['control']['class'];
             foreach ($settings['control']['settings'] as $s) {
                 $wp_customize->add_setting($s, $settings['setting']);
             }
             $wp_customize->add_control(new $class($wp_customize, $name, array('label' => $settings['control']['label'], 'section' => $settings['control']['section'], 'settings' => $settings['control']['settings'])));
         } else {
             $wp_customize->add_control($name, $settings['control']);
         }
         if (isset($settings['partial'])) {
             $wp_customize->selective_refresh->add_partial($name, $settings['partial']);
         }
     }
 }
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:30,代码来源:wpsc-customizer.class.php

示例7: srizon_2016_customize_register

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function srizon_2016_customize_register($wp_customize)
{
    // ----------------------------------------
    // Add a new section called 'Test Controls'
    // ----------------------------------------
    $wp_customize->add_section('srizon_test_section', array('title' => __('Test Controls'), 'priority' => '20'));
    // -----------------------------------------------
    // Add a settings for Google Font Control (below)
    // -----------------------------------------------
    $wp_customize->add_setting('srizon_body_font', array('default' => 'Open Sans'));
    // --------------------
    // Google Font Control
    // --------------------
    $wp_customize->add_control(new Srizon_Control_Google_Font($wp_customize, 'srizon_body_font', array('label' => __('Body Font'), 'section' => 'srizon_test_section', 'settings' => 'srizon_body_font')));
    // ------------------------------------------------------------------------------------------
    // Sample head section for this changes to take effect:
    // sample-output/google-font-header.php
    // ------------------------------------------------------------------------------------------
    // -----------------------------------------
    // Add a settings for Slider Control (below)
    // -----------------------------------------
    $wp_customize->add_setting('srizon_body_font_size', array('default' => '16'));
    // --------------
    // Slider Control
    // --------------
    $wp_customize->add_control(new Srizon_Control_Slider($wp_customize, 'srizon_body_font_size', array('label' => __('Body Font Size'), 'description' => __('Base/Body font size in px'), 'section' => 'srizon_test_section', 'settings' => 'srizon_body_font_size'), array('step' => 1, 'min' => 10, 'max' => 30)));
    // -----------------------------------------
    // Add a settings for Slider Control (below)
    // -----------------------------------------
    $wp_customize->add_setting('srizon_h1_font_size', array('default' => '22'));
    // --------------
    // Slider Control
    // --------------
    $wp_customize->add_control(new Srizon_Control_Slider($wp_customize, 'srizon_h1_font_size', array('label' => __('H1 Font Size'), 'description' => __('H1 font size in px'), 'section' => 'srizon_test_section', 'settings' => 'srizon_h1_font_size'), array('step' => 1, 'min' => 10, 'max' => 40)));
}
开发者ID:AfzalH,项目名称:Srizon-Custom-Controls,代码行数:40,代码来源:customizer.php

示例8: aggression_customize_register

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function aggression_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';
    /**
     * Add Section Layout to the Customizer.
     */
    $wp_customize->add_section('aggression-theme-options', array('title' => __('Theme Options', 'aggression'), 'capability' => 'edit_theme_options', 'description' => 'Edit Theme Options'));
    /**
     * Create Layout Setting.
     */
    $wp_customize->add_setting('aggression_layout_settings', array('default' => 'full-width', 'type' => 'theme_mod', 'sanitize_callback' => 'aggression_layout_setting_sanitize', 'transport' => 'postMessage'));
    /**
     * Add Layout Controls.
     */
    $wp_customize->add_control('aggression_layout_control', array('settings' => 'aggression_layout_settings', 'type' => 'radio', 'label' => __('Layout Options', 'aggression'), 'choices' => array('full-width' => __('Full Width (default)', 'aggression'), 'content-sidebar' => __('Content-Sidebar', 'aggression'), 'sidebar-content' => __('Sidebar-Content', 'aggression'), 'sidebar-content-sidebar' => __('Sidebar-Content-Sidebar', 'aggression'), 'content-sidebar-sidebar' => __('Content-Sidebar-Sidebar', 'aggression'), 'sidebar-sidebar-content' => __('Sidebar-Sidebar-Content', 'aggression')), 'section' => 'aggression-theme-options'));
    /**
     * Page Titles.
     */
    $wp_customize->add_setting('aggression_page_titles_settings', array('default' => 'on', 'type' => 'theme_mod', 'sanitize_callback' => 'aggression_page_title_sanitize', 'transport' => 'postMessage'));
    /**
     * Page Titles Controls.
     */
    $wp_customize->add_control('aggression_page_titles_control', array('settings' => 'aggression_page_titles_settings', 'type' => 'radio', 'label' => __('Page Titles', 'aggression'), 'choices' => array('on' => __('On (default)', 'aggression'), 'off' => __('Off', 'aggression')), 'section' => 'aggression-theme-options'));
}
开发者ID:TheAggressive,项目名称:aggression,代码行数:31,代码来源:customizer.php

示例9: riiskit_theme_customizer

/**
 * Implement Theme Customizer additions and adjustments.
 *
 * @package		Riiskit
 * @subpackage	functions.php
 * @since		1.0.0
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function riiskit_theme_customizer($wp_customize)
{
    $wp_customize->remove_section('colors');
    $wp_customize->remove_section('background_image');
    $wp_customize->remove_section('static_front_page');
    // MOBILE
    // Mobile sidr.js menu on/off
    $wp_customize->add_section('developer', array('title' => __('Developer', 'riiskit'), 'priority' => 2, 'description' => __('Options for the developer.', 'riiskit')));
    // toggle/slideout selection
    $wp_customize->add_setting('developer_menu_type', array('default' => 'toggle-menu', 'type' => 'option', 'capability' => 'activate_plugins', 'sanitize_callback', 'riiskit_sanitize_menu_type'));
    $wp_customize->add_control('developer_menu_type', array('label' => __('Menutype', 'riiskit'), 'section' => 'developer', 'settings' => 'developer_menu_type', 'type' => 'select', 'choices' => array('toggle-menu' => 'Toggle', 'slideout-menu' => 'Slideout')));
    // SOCIAL
    $wp_customize->add_section('social', array('title' => __('Social', 'riiskit'), 'description' => __('Add links to your social profiles.', 'riiskit'), 'priority' => 135));
    $social_links = array();
    // Facebook
    $social_links[] = array('slug' => 'social_facebook_link', 'label' => 'Facebook');
    // Twitter
    $social_links[] = array('slug' => 'social_twitter_link', 'label' => 'Twitter');
    foreach ($social_links as $link) {
        // SETTINGS
        $wp_customize->add_setting($link['slug'], array('type' => 'option', 'sanitize_callback' => 'riiskit_sanitize_url'));
        // CONTROLS
        $wp_customize->add_control($link['slug'], array('label' => $link['label'], 'section' => 'social', 'settings' => $link['slug'], 'type' => 'text'));
    }
}
开发者ID:Jeger,项目名称:riiskit,代码行数:34,代码来源:customizer.php

示例10: wplook_customize_register

/**
 * @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');
}
开发者ID:craighays,项目名称:nsfhp,代码行数:35,代码来源:customize.php

示例11: action__customize_register

 /**
  * Add multilingual controls.
  * The original controls will be hidden.
  * @param WP_Customize_Manager $wp_customize
  */
 public static function action__customize_register(WP_Customize_Manager $wp_customize)
 {
     /**
      * Blog Name
      */
     $wp_customize->add_setting('wpglobus_blogname', array('default' => WPGlobus_Core::text_filter(get_bloginfo('name'), WPGlobus::Config()->language)));
     $wp_customize->get_setting('wpglobus_blogname')->transport = 'postMessage';
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'wpglobus_blogname', array('label' => __('Site Title'), 'type' => 'text', 'section' => 'title_tagline', 'settings' => 'wpglobus_blogname', 'values' => WPGlobus_Core::text_filter(get_bloginfo('name'), WPGlobus::Config()->language), 'input_attrs' => array('class' => 'wpglobus-customize-control wpglobus-not-trigger-change'))));
     /**
      * Blog Description
      */
     $wp_customize->add_setting('wpglobus_blogdescription', array('default' => WPGlobus_Core::text_filter(get_bloginfo('description'), WPGlobus::Config()->language)));
     $wp_customize->get_setting('wpglobus_blogdescription')->transport = 'postMessage';
     $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'wpglobus_blogdescription', array('label' => __('Tagline'), 'type' => 'text', 'section' => 'title_tagline', 'settings' => 'wpglobus_blogdescription', 'input_attrs' => array('class' => 'wpglobus-customize-control wpglobus-not-trigger-change'))));
     /**
      * Add elements from wpglobus-config.json
      */
     if (empty(WPGlobus::Config()->WPGlobus_WP_Theme)) {
         return;
     }
     foreach (WPGlobus::Config()->WPGlobus_WP_Theme->elements as $key => $value) {
         /**
          * $value['type']
          * @see https://codex.wordpress.org/Class_Reference/WP_Customize_Control  for Input Types 
          */
         $wp_customize->add_setting($key, array('default' => ''));
         $wp_customize->get_setting($key)->transport = 'postMessage';
         $wp_customize->add_control(new WP_Customize_Control($wp_customize, $key, array('label' => '{{title}}', 'description' => '{{description}}', 'type' => $value['type'], 'section' => $value['section'], 'settings' => $key, 'input_attrs' => array('class' => 'wpglobus-customize-control wpglobus-control-' . $value['type'], 'data-type' => $value['type'], 'data-source' => ''))));
     }
 }
开发者ID:rodica-andronache,项目名称:WPGlobus,代码行数:35,代码来源:class-wpglobus-customize.php

示例12: simplicize_customize_register

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function simplicize_customize_register($wp_customize)
{
    // Set site name and description text to be previewed in real-time
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    // Set site title color to be previewed in real-time
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    // Site Title Section
    $wp_customize->add_section('title_tagline', array('title' => __('Site Title, Tagline & Logo', 'simplicize'), 'priority' => 1));
    //Logo Uploader
    $wp_customize->add_setting('simplicize_logo');
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'simplicize_logo', array('label' => __('Logo', 'simplicize'), 'section' => 'title_tagline', 'settings' => 'simplicize_logo', 'priority' => 1)));
    // Site Title Align
    $wp_customize->add_setting('title_align', array('default' => 'center', 'sanitize_callback' => 'simplicize_sanitize_logo_align'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'title_align', array('type' => 'radio', 'label' => __('Title & Logo Alignment', 'simplicize'), 'section' => 'title_tagline', 'choices' => array('left' => __('Left Align', 'simplicize'), 'center' => __('Center Align', 'simplicize'), 'right' => __('Right Align', 'simplicize')), 'priority' => 60)));
    //Layout
    $wp_customize->add_section('simplicize_layout_section', array('title' => __('Layout', 'simplicize'), 'priority' => 104));
    // Display Blog Author
    $wp_customize->add_setting('display_author_blog', array('default' => true, 'sanitize_callback' => 'simplicize_sanitize_checkbox'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'display_author_blog', array('label' => __('Show Blog Author Link?', 'simplicize'), 'section' => 'simplicize_layout_section', 'settings' => 'display_author_blog', 'type' => 'checkbox', 'priority' => 60)));
    // Display Blog Date
    $wp_customize->add_setting('display_date_blog', array('default' => true, 'sanitize_callback' => 'simplicize_sanitize_checkbox'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'display_date_blog', array('label' => __('Show Blog Date?', 'simplicize'), 'section' => 'simplicize_layout_section', 'settings' => 'display_date_blog', 'type' => 'checkbox', 'priority' => 60)));
    // Display Post Featured Image or Video
    $wp_customize->add_setting('display_feature_post', array('default' => true, 'sanitize_callback' => 'simplicize_sanitize_checkbox'));
    $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'display_feature_post', array('label' => __('Show Post Featured Images?', 'simplicize'), 'section' => 'simplicize_layout_section', 'settings' => 'display_feature_post', 'type' => 'checkbox', 'priority' => 80)));
}
开发者ID:ajbiscaro,项目名称:Simplicize-Theme,代码行数:32,代码来源:customizer.php

示例13: the_monday_customize_register

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function the_monday_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';
    /*------------------------------------------------------------------------------------------------------------------------------*/
    /**
     * Theme info
     */
    $pro_themes_url = esc_url('https://accesspressthemes.com/wordpress-themes/');
    $the_monday_more_themes = __('View more Free Themes ', 'the-monday') . ': <a href="' . esc_url(admin_url() . '/themes.php?page=the-monday-themes') . '">' . __(' here', 'the-monday') . '</a>';
    $the_monday_pro_themes = __('View Pro Themes ', 'the-monday') . ': <a href="' . esc_url('https://accesspressthemes.com/wordpress-themes/') . '">' . __(' here', 'the-monday') . '</a>';
    $the_monday_uesful_plugins = __('AccessPress Useful Plugins ', 'the-monday') . ': <a href="' . esc_url('https://accesspressthemes.com/plugins/') . '">' . __(' here', 'the-monday') . '</a>';
    $the_monday_about_theme = __('The Monday is powerful features rich WordPress Free theme developed by AccessPress. ', 'the-monday');
    $wp_customize->add_section('the_monday_themeinfo', array('title' => __('Theme info', 'the-monday'), 'priority' => 99));
    // More Themes
    $wp_customize->add_setting('the_monday_more_themes', array('type' => 'theme_info', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr'));
    $wp_customize->add_control(new The_Monday_Theme_Info($wp_customize, 'the_monday_more_themes', array('section' => 'the_monday_themeinfo', 'label' => __('More Themes', 'the-monday'), 'description' => $the_monday_more_themes, 'priority' => 5)));
    //Pro Themes
    $wp_customize->add_setting('the_monday_pro_themes', array('type' => 'theme_info', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr'));
    $wp_customize->add_control(new The_Monday_Theme_Info($wp_customize, 'the_monday_pro_themes', array('section' => 'the_monday_themeinfo', 'label' => __('Pro Themes', 'the-monday'), 'description' => $the_monday_pro_themes, 'priority' => 5)));
    //Usesful Plugins
    $wp_customize->add_setting('the_monday_useful_plugins', array('type' => 'theme_info', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr'));
    $wp_customize->add_control(new The_Monday_Theme_Info($wp_customize, 'the_monday_useful_plugins', array('section' => 'the_monday_themeinfo', 'label' => __('Useful Plugins ', 'the-monday'), 'description' => $the_monday_uesful_plugins, 'priority' => 5)));
    //Usesful Plugins
    $wp_customize->add_setting('the_monday_about_theme', array('type' => 'theme_info', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr'));
    $wp_customize->add_control(new The_Monday_Theme_Info($wp_customize, 'the_monday_about_theme', array('section' => 'the_monday_themeinfo', 'label' => __('About The Monday ', 'the-monday'), 'description' => $the_monday_about_theme, 'priority' => 5)));
}
开发者ID:BingCool852,项目名称:themes,代码行数:33,代码来源:customizer.php

示例14: coursepress_customize_register

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function coursepress_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 = array();
    $colors[] = array('slug' => 'body_text_color', 'default' => '#878786', 'label' => __('Body Text Color', 'cp'));
    $colors[] = array('slug' => 'content_text_color', 'default' => '#666666', 'label' => __('Content Text Color', 'cp'));
    $colors[] = array('slug' => 'content_header_color', 'default' => '#878786', 'label' => __('Content Header Color', 'cp'));
    $colors[] = array('slug' => 'content_link_color', 'default' => '#1cb8ea', 'label' => __('Content Links Color', 'cp'));
    $colors[] = array('slug' => 'content_link_hover_color', 'default' => '#1cb8ea', 'label' => __('Content Links Hover Color', 'cp'));
    $colors[] = array('slug' => 'main_navigation_link_color', 'default' => '#666', 'label' => __('Main Navigation Links Color', 'cp'));
    $colors[] = array('slug' => 'main_navigation_link_hover_color', 'default' => '#74d1d4', 'label' => __('Main Navigation Links Hover Color', 'cp'));
    $colors[] = array('slug' => 'footer_background_color', 'default' => '#f2f6f8', 'label' => __('Footer Background Color', 'cp'));
    $colors[] = array('slug' => 'footer_link_color', 'default' => '#83abb6', 'label' => __('Footer Links Color', 'cp'));
    $colors[] = array('slug' => 'footer_link_hover_color', 'default' => '#74d1d4', 'label' => __('Footer Links Hover Color', 'cp'));
    $colors[] = array('slug' => 'widget_title_color', 'default' => '#c0c21e', 'label' => __('Widgets Title Color', 'cp'));
    sort($colors);
    foreach ($colors as $color) {
        // SETTINGS
        $wp_customize->add_setting($color['slug'], array('default' => $color['default'], 'type' => 'option', 'capability' => 'edit_theme_options'));
        // CONTROLS
        $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $color['slug'], array('label' => $color['label'], 'section' => 'colors', 'settings' => $color['slug'])));
    }
    $wp_customize->add_setting('coursepress_logo', array('default' => get_template_directory_uri() . '/images/logo-default.png', 'type' => 'theme_mod', 'capability' => 'edit_theme_options'));
    $wp_customize->add_section('cp_logo_section', array('title' => __('Logo', 'cp'), 'priority' => 1));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array('label' => __('Upload a logo', 'cp'), 'section' => 'cp_logo_section', 'settings' => 'coursepress_logo')));
    if ($wp_customize->is_preview() && !is_admin()) {
        add_action('wp_footer', 'coursepress_customize_preview', 21);
    }
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:36,代码来源:customizer.php

示例15: adaptable_customize_register

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function adaptable_customize_register($wp_customize)
{
    /*class Color_Scheme_Custom_Control extends WP_Customize_Control {
    		public function render_content() {
    			?>
    			<label>
    	              <span class="customize-color-scheme-control"><?php echo esc_html( $this->label ); ?></span>
    	              <ul>
    	                <li><img src="<?php echo get_template_directory_uri() . '/images/eggplant.png' ?>" alt="Eggplant" /><input type="radio" name="<?php echo $this->id; ?>" id="<?php echo $this->id; ?>[style.css]" value="1" /></li>
    	                <li><img src="<?php echo get_template_directory_uri() . '/images/silverblue.png' ?>" alt="Silver Blue" /><input type="radio" name="<?php echo $this->id; ?>" id="<?php echo $this->id; ?>[bluewhitegray.css]" value="1" /></li>
    	              </ul>
    	        </label>
    			<?php
    		}
    	}*/
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
    /* Adding a logo/image at the top of the sidebar */
    $wp_customize->add_section('adaptable_logo_section', array('title' => __('Logo/Sidebar Image', 'adaptable'), 'priority' => 30, 'description' => 'Upload an image to appear at the top of the sidebar. Examples include a logo or blogger photo.'));
    $wp_customize->add_setting('adaptable_logo');
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'adaptable_logo', array('label' => __('Logo/Sidebar Image', 'adaptable'), 'section' => 'adaptable_logo_section', 'settings' => 'adaptable_logo')));
    /* Add color scheme options */
    $wp_customize->add_setting('adaptable_color_scheme');
    $wp_customize->add_control('adaptable_color_scheme', array('label' => __('Color Scheme', 'adaptable'), 'section' => 'colors', 'settings' => 'adaptable_color_scheme', 'type' => 'radio', 'choices' => array('style.css' => 'Eggplant (Default)', 'bluewhitegray.css' => "Blue/White/Gray")));
}
开发者ID:rmleg,项目名称:modular,代码行数:31,代码来源:customizer.php


注:本文中的WP_Customize_Manager::add_control方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。