本文整理汇总了PHP中Kirki::add_field方法的典型用法代码示例。如果您正苦于以下问题:PHP Kirki::add_field方法的具体用法?PHP Kirki::add_field怎么用?PHP Kirki::add_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kirki
的用法示例。
在下文中一共展示了Kirki::add_field方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_customize_controls_print_scripts
public function test_customize_controls_print_scripts()
{
Kirki::add_field('', array('settings' => 'foo', 'type' => 'text', 'section' => 'bar', 'help' => 'Lorem Ipsum'));
$script = '$( "<a href=\'#\' class=\'tooltip hint--left\' data-hint=\'Lorem Ipsum\'><span class=\'dashicons dashicons-info\'></span></a>" ).prependTo( "#customize-control-foo" );';
$this->expectOutputString('<script>jQuery(document).ready(function($) { "use strict"; ' . $script . '});</script>');
Kirki()->scripts->tooltips->customize_controls_print_footer_scripts();
}
示例2: add_field
public function add_field()
{
Kirki::add_field('my_config', array('settings' => 'my_setting', 'label' => __('My custom control', 'translation_domain'), 'section' => 'my_section', 'type' => 'text', 'priority' => 10, 'default' => 'some-default-value'));
Kirki::add_field('my_config', array('settings' => 'my_setting0', 'label' => __('My custom control', 'translation_domain'), 'section' => 'my_section', 'type' => 'text', 'priority' => 10, 'default' => 'some-default-value'));
Kirki::add_field('my_config2', array('settings' => 'my_setting1', 'label' => __('My custom control', 'translation_domain'), 'section' => 'my_section', 'type' => 'text', 'priority' => 10, 'default' => 'some-default-value'));
Kirki::add_field('my_config3', array('settings' => 'my_setting2', 'label' => __('My custom control', 'translation_domain'), 'section' => 'my_section', 'type' => 'text', 'priority' => 10, 'default' => 'some-default-value'));
Kirki::add_field('my_config', array('settings' => 'my_setting_2', 'label' => __('My custom control 2', 'translation_domain'), 'section' => 'my_section', 'type' => 'checkbox', 'priority' => 20, 'default' => '1', 'capability' => 'edit_theme_options'));
}
示例3: fields_from_filters
/**
* Process fields added using the 'kirki/fields' and 'kirki/controls' filter.
* These filters are no longer used, this is simply for backwards-compatibility
*/
public function fields_from_filters()
{
$fields = apply_filters('kirki/controls', array());
$fields = apply_filters('kirki/fields', $fields);
if (!empty($fields)) {
foreach ($fields as $field) {
Kirki::add_field('global', $field);
}
}
}
示例4: test_generate_script
public function test_generate_script()
{
$js_vars = array('element' => 'body', 'function' => 'css', 'property' => 'color');
Kirki::add_field('', array('settings' => 'foo', 'type' => 'text', 'transport' => 'postMessage', 'js_vars' => $js_vars));
set_theme_mod('foo', '#333');
$wp_customize = $this->init_customizer();
$this->assertEquals('wp.customize( \'foo\', function( value ) {value.bind( function( newval ) {$(\'body\').css(\'color\', newval );}); });', Kirki()->scripts->postmessage->generate_script());
$js_vars = array('element' => 'body', 'function' => 'html');
Kirki::add_field('', array('settings' => 'foo', 'type' => 'text', 'transport' => 'postMessage', 'js_vars' => $js_vars));
set_theme_mod('foo', 'this is a string');
$wp_customize = $this->init_customizer();
$this->assertEquals('wp.customize( \'foo\', function( value ) {value.bind( function( newval ) {$(\'body\').html( newval );}); });', Kirki()->scripts->postmessage->generate_script());
}
示例5: add_fields_via_api
/**
* Add fields using the Kirki API
*/
public function add_fields_via_api()
{
$args = $this->field;
$args['section'] = sanitize_key($this->field['type']);
$args['capability'] = 'read';
$args['settings'] = sanitize_key($this->field['type']) . '_demo_3';
$args['label'] = sprintf(__('%s theme_mod via API', 'kirki'), $args['type']);
$args['option_type'] = 'theme_mod';
Kirki::add_field('', $args);
$args['settings'] = sanitize_key($this->field['type']) . '_demo_4';
$args['label'] = sprintf(__('%s single option via API', 'kirki'), $args['type']);
$args['option_type'] = 'option';
Kirki::add_field('', $args);
$args['settings'] = sanitize_key($this->field['type']) . '_demo_5';
$args['option_type'] = 'option';
$args['label'] = sprintf(__('%s serialized option via API', 'kirki'), $args['type']);
$args['option_name'] = 'kirki_test';
Kirki::add_field('', $args);
}
示例6: array
<?php
/**
* Site General
* ================
*/
$section = 'site_general';
$priority = 3;
Kirki::add_field('tm-polygon', array('type' => 'select', 'setting' => 'skin', 'label' => esc_html__('Skin', 'tm-polygon'), 'section' => $section, 'choices' => apply_filters('tm_customizer_skins', array()), 'priority' => 1, 'default' => apply_filters('tm_customizer_default_skin', ''), 'transport' => 'postMessage'));
if (function_exists('tm_bread_crumb')) {
Kirki::add_field('tm-polygon', array('type' => 'custom', 'setting' => 'site_general_group_title_' . $priority++, 'section' => $section, 'priority' => $priority++, 'default' => '<div class="group_title">Breadcrumb</div>'));
Kirki::add_field('tm-polygon', array('type' => 'toggle', 'setting' => 'site_general_breadcrumb_enable', 'label' => esc_html__('Breadcrumb', 'tm-polygon'), 'description' => esc_html__('Enabling this option will display breadcrumb on every page', 'tm-polygon'), 'section' => $section, 'priority' => $priority++, 'default' => 1));
Kirki::add_field('tm-polygon', array('type' => 'custom', 'setting' => 'site_general_hr_' . $priority++, 'section' => $section, 'priority' => $priority++, 'default' => '<hr />', 'required' => array(array('setting' => 'site_general_breadcrumb_enable', 'operator' => '==', 'value' => 1))));
Kirki::add_field('tm-polygon', array('type' => 'text', 'setting' => 'site_general_breadcrumb_home_text', 'label' => esc_html__('"Home" text', 'tm-polygon'), 'section' => $section, 'priority' => $priority++, 'default' => 'Home', 'required' => array(array('setting' => 'site_general_breadcrumb_enable', 'operator' => '==', 'value' => 1))));
Kirki::add_field('tm-polygon', array('type' => 'custom', 'setting' => 'site_general_hr_' . $priority++, 'section' => $section, 'priority' => $priority++, 'default' => '<hr />', 'required' => array(array('setting' => 'site_general_breadcrumb_enable', 'operator' => '==', 'value' => 1))));
Kirki::add_field('tm-polygon', array('type' => 'text', 'setting' => 'site_general_breadcrumb_you_are_here_text', 'label' => esc_html__('"You are here" text', 'tm-polygon'), 'section' => $section, 'priority' => $priority++, 'default' => 'You are here:', 'required' => array(array('setting' => 'site_general_breadcrumb_enable', 'operator' => '==', 'value' => 1))));
}
Kirki::add_field('tm-polygon', array('type' => 'custom', 'setting' => 'site_general_group_title_' . $priority++, 'section' => $section, 'priority' => $priority++, 'default' => '<div class="group_title">Other settings</div>'));
Kirki::add_field('tm-polygon', array('type' => 'toggle', 'setting' => 'site_general_boxed', 'label' => esc_html__('Boxed mode', 'tm-polygon'), 'description' => esc_html__('Turn on this option if you want to enable box mode for content', 'tm-polygon'), 'section' => $section, 'priority' => $priority++, 'default' => 0));
示例7: ocin_lite_Display_Text_Control
$wp_customize->add_control(new ocin_lite_Display_Text_Control($wp_customize, 'ocin_lite_probtn_colors', array('section' => 'colors', 'label' => sprintf(__('Check out the <a href="%s" target="_blank">PRO version</a> to change Text, Links and Featured colors.', 'ocin-lite'), 'https://www.quemalabs.com/theme/ocin/'))));
/*
Shop Categories selection
------------------------------ */
if (class_exists('WooCommerce') || class_exists('Kirki')) {
$wp_customize->add_section('ocin_lite_shop_options', array('title' => esc_attr__('Shop Options', 'ocin-lite'), 'priority' => 120));
$wp_customize->add_setting('ocin_lite_shop_categories', array('default' => array(''), 'sanitize_callback' => 'ocin_lite_sanitize_multicheck', 'type' => 'theme_mod'));
$all_categories = get_categories(array('taxonomy' => 'product_cat'));
$woo_categories = array();
if ($all_categories) {
foreach ($all_categories as $cat) {
$woo_categories[$cat->slug] = $cat->name;
}
}
$wp_customize->add_control(new Kirki_Controls_MultiCheck_Control($wp_customize, 'ocin_lite_shop_categories', array('label' => esc_attr__('Shop Categories', 'ocin-lite'), 'section' => 'ocin_lite_shop_options', 'choices' => $woo_categories, 'description' => esc_attr__('Select categories for the shop categories menu.', 'ocin-lite'))));
Kirki::add_field('ocin_lite_shop_products_amount', array('type' => 'number', 'settings' => 'ocin_lite_shop_products_amount', 'label' => esc_attr__("Number of products", 'ocin-lite'), 'description' => esc_attr__('Number of products displayed per page.', 'ocin-lite'), 'section' => 'ocin_lite_shop_options', 'default' => 12));
}
//if plugin exists
/*
PRO Version
------------------------------ */
$wp_customize->add_section('ocin_lite_pro_section', array('title' => esc_attr__('PRO version', 'ocin-lite'), 'priority' => 160));
$wp_customize->add_setting('ocin_lite_probtn', array('default' => '', 'sanitize_callback' => 'coni_sanitize_text'));
$wp_customize->add_control(new ocin_lite_Display_Text_Control($wp_customize, 'ocin_lite_probtn', array('section' => 'ocin_lite_pro_section', 'label' => sprintf(__('Check out the PRO version for more features. %s View PRO version %s', 'ocin-lite'), '<a target="_blank" class="button" href="https://www.quemalabs.com/theme/ocin/?utm_source=Ocin Lite%20Lite%20Theme&utm_medium=Pro%20Button&utm_campaign=Ocin Lite" style="width: 80%; margin: 10px auto; display: block; text-align: center;">', '</a>'))));
}
add_action('customize_register', 'ocin_lite_customize_register');
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function ocin_lite_customize_preview_js()
{
示例8: array
<?php
/**
* Footer Layout
* ==============
*/
$section = 'footer_layout';
$priority = 1;
Kirki::add_field('tm-polygon', array('type' => 'toggle', 'setting' => 'footer_layout_enable', 'label' => esc_html__('Use footer', 'tm-polygon'), 'description' => esc_html__('Enabling this option will display footer area', 'tm-polygon'), 'section' => $section, 'priority' => $priority++, 'default' => 1));
示例9: array
<?php
Kirki::add_section('theme_logo', array('title' => __('Logo'), 'description' => __('Tilføj logo til temaets positioner'), 'panel' => '', 'priority' => 160, 'capability' => 'edit_theme_options', 'theme_supports' => ''));
Kirki::add_field('smamo_conf', array('settings' => 'logo_large', 'label' => __('Stort logo', 'smamo'), 'section' => 'theme_logo', 'type' => 'image', 'priority' => 10, 'default' => null));
Kirki::add_field('smamo_conf', array('settings' => 'logo_medium', 'label' => __('Bredt logo', 'smamo'), 'section' => 'theme_logo', 'type' => 'image', 'priority' => 11, 'default' => null));
Kirki::add_field('smamo_conf', array('settings' => 'logo_small', 'label' => __('Lille logo', 'smamo'), 'section' => 'theme_logo', 'type' => 'image', 'priority' => 12, 'default' => null));
示例10: array
<?php
/**
* GENERAL / SITE LOGOS
*/
Kirki::add_field('fb', array('type' => 'image', 'settings' => 'default_logo', 'label' => __('Basic Logo', 'flatbook'), 'description' => __('Optional dimensions: 140px x 30px', 'flatbook'), 'section' => 'site_logos', 'default' => get_template_directory_uri() . '/assets/img/logo.png', 'priority' => 10));
Kirki::add_field('fb', array('type' => 'image', 'settings' => 'retina_logo', 'label' => __('Retina Logo', 'flatbook'), 'description' => __('Double sized (2x) version of the Basic Logo.', 'flatbook'), 'section' => 'site_logos', 'default' => get_template_directory_uri() . '/assets/img/logo@2x.png', 'priority' => 20));
Kirki::add_field('fb', array('type' => 'image', 'settings' => 'small_logo', 'label' => __('Small Logo', 'flatbook'), 'description' => __('Optional dimensions: 80px x 80px', 'flatbook'), 'section' => 'site_logos', 'default' => get_template_directory_uri() . '/assets/img/logo_sm.png', 'priority' => 30));
Kirki::add_field('fb', array('type' => 'image', 'settings' => 'admin_logo', 'label' => __('Admin Logo', 'flatbook'), 'description' => __('Optional dimensions: 170px x 70px', 'flatbook'), 'section' => 'site_logos', 'default' => get_template_directory_uri() . '/assets/img/admin_logo.png', 'priority' => 40));
/**
* GENERAL / SOCIAL LINKS
*/
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'behance_url', 'default' => '', 'label' => __('Behance', 'flatbook'), 'section' => 'general_socials', 'priority' => 9));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'bitbucket_url', 'default' => '', 'label' => __('BitBucket', 'flatbook'), 'section' => 'general_socials', 'priority' => 10));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'dribbble_url', 'default' => '', 'label' => __('Dribbble', 'flatbook'), 'section' => 'general_socials', 'priority' => 11));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'facebook_url', 'default' => '', 'label' => __('Facebook', 'flatbook'), 'section' => 'general_socials', 'priority' => 12));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'flickr_url', 'default' => '', 'label' => __('Flickr', 'flatbook'), 'section' => 'general_socials', 'priority' => 13));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'github_url', 'default' => '', 'label' => __('GitHub', 'flatbook'), 'section' => 'general_socials', 'priority' => 14));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'googleplus_url', 'default' => '', 'label' => __('Google+', 'flatbook'), 'section' => 'general_socials', 'priority' => 15));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'instagram_url', 'default' => '', 'label' => __('Instagram', 'flatbook'), 'section' => 'general_socials', 'priority' => 16));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'linkedin_url', 'default' => '', 'label' => __('LinkedIn', 'flatbook'), 'section' => 'general_socials', 'priority' => 17));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'pinterest_url', 'default' => '', 'label' => __('Pinterest', 'flatbook'), 'section' => 'general_socials', 'priority' => 18));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'reddit_url', 'default' => '', 'label' => __('Reddit', 'flatbook'), 'section' => 'general_socials', 'priority' => 19));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'skype_url', 'default' => '', 'label' => __('Skype', 'flatbook'), 'section' => 'general_socials', 'priority' => 20));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'tumblr_url', 'default' => '', 'label' => __('Tumblr', 'flatbook'), 'section' => 'general_socials', 'priority' => 21));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'twitter_url', 'default' => '', 'label' => __('Twitter', 'flatbook'), 'section' => 'general_socials', 'priority' => 22));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'vimeo_url', 'default' => '', 'label' => __('Vimeo', 'flatbook'), 'section' => 'general_socials', 'priority' => 23));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'youtube_url', 'default' => '', 'label' => __('Youtube', 'flatbook'), 'section' => 'general_socials', 'priority' => 24));
示例11: array
Kirki::add_field('fb', array('type' => 'switch', 'settings' => 'blog_page_display_footer_widgets', 'label' => __('Display Footer Widgets', 'flatbook'), 'section' => 'blog_page', 'default' => '0', 'priority' => 30));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'blog_posts_per_page', 'label' => __('Posts Per Page', 'flatbook'), 'section' => 'blog_page', 'default' => 4, 'priority' => 33));
Kirki::add_field('fb', array('type' => 'custom', 'settings' => 'panel_blog_title_2', 'section' => 'blog_page', 'default' => '<hr><h3>' . __('Post Layout', 'flatbook') . '</h3>', 'priority' => 35));
Kirki::add_field('fb', array('type' => 'switch', 'settings' => 'blog_page_display_post_header', 'label' => __('Display Post Header', 'flatbook'), 'section' => 'blog_page', 'default' => '1', 'priority' => 40));
Kirki::add_field('', array('type' => 'radio', 'settings' => 'blog_entry_content_align', 'label' => __('Text Alignment', 'flatbook'), 'section' => 'blog_page', 'default' => 'justify', 'priority' => 45, 'choices' => array('left' => __('Left', 'flatbook'), 'center' => __('Center', 'flatbook'), 'right' => __('Right', 'flatbook'), 'justify' => __('Justify', 'flatbook')), 'output' => array('element' => '.blog .blog-post .entry-content', 'property' => 'text-align'), 'transport' => 'postMessage', 'js_vars' => array('element' => '.blog .blog-post .entry-content', 'function' => 'css', 'property' => 'text-align')));
Kirki::add_field('', array('type' => 'text', 'settings' => 'blog_read_more_text', 'label' => __('Read More Text', 'flatbook'), 'section' => 'blog_page', 'default' => __('Continue Reading', 'flatbook'), 'priority' => 50));
Kirki::add_field('fb', array('type' => 'switch', 'settings' => 'blog_page_display_post_footer', 'label' => __('Display Post Footer', 'flatbook'), 'section' => 'blog_page', 'default' => '1', 'priority' => 55));
/**
* PAGES / SINGLE
*/
Kirki::add_field('fb', array('type' => 'custom', 'settings' => 'panel_blog_single_title_1', 'section' => 'blog_single', 'default' => '<h3>' . __('Page Layout', 'flatbook') . '</h3>', 'priority' => 10));
Kirki::add_field('fb', array('type' => 'color', 'settings' => 'blog_single_background_color', 'label' => __('Background Color', 'flatbook'), 'section' => 'blog_single', 'default' => '#F2ECEC', 'priority' => 12, 'output' => array('element' => '.single', 'property' => 'background-color'), 'transport' => 'postMessage', 'js_vars' => array('element' => 'single', 'function' => 'css', 'property' => 'background-color')));
Kirki::add_field('fb', array('type' => 'switch', 'settings' => 'blog_single_display_header', 'label' => __('Display Page Header', 'flatbook'), 'section' => 'blog_single', 'default' => '1', 'priority' => 15));
Kirki::add_field('fb', array('type' => 'radio', 'label' => __('Page Header Title', 'flatbook'), 'settings' => 'blog_single_header_title', 'section' => 'blog_single', 'default' => 'blog-page-title', 'priority' => 20, 'choices' => array('blog-page-title' => __('Shows the blog page title', 'flatbook'), 'single-post-title' => __('Shows the single post title', 'flatbook'))));
Kirki::add_field('fb', array('type' => 'switch', 'settings' => 'blog_single_display_sidebar', 'label' => __('Display Blog Sidebar', 'flatbook'), 'section' => 'blog_single', 'default' => '1', 'priority' => 25));
Kirki::add_field('fb', array('type' => 'switch', 'settings' => 'blog_single_display_footer_subscribe', 'label' => __('Display Footer Subscribe', 'flatbook'), 'section' => 'blog_single', 'default' => '0', 'priority' => 30));
Kirki::add_field('fb', array('type' => 'switch', 'settings' => 'blog_single_display_footer_widgets', 'label' => __('Display Footer Widgets', 'flatbook'), 'section' => 'blog_single', 'default' => '0', 'priority' => 35));
Kirki::add_field('fb', array('type' => 'custom', 'settings' => 'panel_blog_single_title_2', 'section' => 'blog_single', 'default' => '<hr><h3>' . __('Post Layout', 'flatbook') . '</h3>', 'priority' => 40));
Kirki::add_field('', array('type' => 'radio', 'settings' => 'blog_single_post_content_align', 'label' => __('Post Content Align', 'flatbook'), 'section' => 'blog_single', 'default' => 'left', 'priority' => 45, 'choices' => array('left' => __('Left', 'flatbook'), 'center' => __('Center', 'flatbook'), 'right' => __('Right', 'flatbook'), 'justify' => __('Justify', 'flatbook')), 'output' => array('element' => '.single .blog-post .entry-content', 'property' => 'text-align'), 'transport' => 'postMessage', 'js_vars' => array('element' => '.single .blog-post .entry-content', 'function' => 'css', 'property' => 'text-align')));
/**
* PAGES / 404
*/
Kirki::add_field('fb', array('type' => 'custom', 'settings' => 'error_page_title_1', 'section' => 'error_page', 'default' => '<h3>' . __('Page Layout', 'flatbook') . '</h3>', 'priority' => 10));
Kirki::add_field('fb', array('type' => 'color', 'settings' => 'error_page_background_color', 'label' => __('Background Color', 'flatbook'), 'section' => 'error_page', 'default' => '#3D3F3E', 'priority' => 15, 'output' => array('element' => '.error404', 'property' => 'background-color'), 'transport' => 'postMessage', 'js_vars' => array(array('element' => '.error404', 'function' => 'css', 'property' => 'background-color'))));
Kirki::add_field('fb', array('type' => 'custom', 'settings' => 'error_page_title_2', 'section' => 'error_page', 'default' => '<hr><h3>' . __('404 Content', 'flatbook') . '</h3>', 'priority' => 20));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'error_page_title', 'label' => __('Heading', 'flatbook'), 'section' => 'error_page', 'default' => __('Oooops...', 'flatbook'), 'priority' => 25));
Kirki::add_field('fb', array('type' => 'textarea', 'settings' => 'error_page_texts', 'label' => __('Paragraph', 'flatbook'), 'section' => 'error_page', 'default' => __('Sorry, the page you are looking for does not exist..', 'flatbook'), 'priority' => 30));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'error_page_home_link_text', 'label' => __('Home Link Text', 'flatbook'), 'section' => 'error_page', 'default' => __('To Homepage', 'flatbook'), 'priority' => 35));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'error_page_custom_link_text', 'label' => __('Custom Link Text', 'flatbook'), 'section' => 'error_page', 'default' => __('Purchase Now', 'flatbook'), 'priority' => 40));
Kirki::add_field('fb', array('type' => 'text', 'settings' => 'error_page_custom_link_url', 'label' => __('Custom Link Url', 'flatbook'), 'section' => 'error_page', 'default' => 'http://themeforest.net/item/flatbook-flat-ebook-selling-wordpress-theme/6023410', 'priority' => 45));
示例12: add_theme_mod_field
public function add_theme_mod_field()
{
Kirki::add_field('', array('type' => 'text', 'settings' => 'the_mod_option', 'section' => 'my_section', 'default' => 'foo', 'priority' => 20, 'option_type' => 'theme_mod'));
}
示例13: setSection
//.........这里部分代码省略.........
$field['description'] = isset($field['subtitle']) ? $field['subtitle'] : '';
$field['choices'] = isset($field['options']) ? $field['options'] : '';
$field['label'] = isset($field['title']) ? $field['title'] : '';
switch ($field['type']) {
case 'ace_editor':
$field['type'] = 'textarea';
break;
case 'button_set':
$field['type'] = 'radio-buttonset';
break;
case 'checkbox':
if (isset($field['options']) && is_array($field['options'])) {
$field['type'] = 'multicheck';
}
case 'color_rgba':
$field['type'] = 'color-alpha';
if (isset($field['default']) && is_array($field['default'])) {
$field['default']['color'] = isset($field['default']['color']) ? Kirki_Color::sanitize_hex($field['default']['color'], true) : '#ffffff';
$field['default']['alpha'] = isset($field['default']['alpha']) ? $field['default']['alpha'] : '1';
$field['default'] = Kirki_Color::get_rgba($field['default']['color'], $field['default']['alpha']);
}
break;
case 'image_select':
$field['type'] = 'radio-image';
break;
case 'info':
$fiel['label'] = '';
$field['help'] = '';
$field['type'] = 'custom';
$background_color = '#fcf8e3';
$border_color = '#faebcc';
$text_color = '#8a6d3b';
if (isset($field['style'])) {
if ('success' == $field['style']) {
$background_color = '#dff0d8';
$border_color = '#d6e9c6';
$text_color = '#3c763d';
} elseif ('critical' == $field['style']) {
$background_color = '#f2dede';
$border_color = '#ebccd1';
$text_color = '#a94442';
}
}
$field['default'] = '<div style="padding: 10px;background:' . $background_color . ';border-radius:4px;border:1px solid ' . $border_color . ';color:' . $text_color . ';">';
$field['default'] .= isset($field['title']) ? '<h4>' . $field['title'] . '</h4>' : '';
$field['default'] .= isset($field['desc']) ? $field['desc'] : '';
$field['default'] .= '</div>';
break;
case 'palette':
$field['choices'] = $field['palettes'];
break;
case 'raw':
$field['default'] = $field['content'];
break;
case 'select':
if (is_array($field['choices'])) {
foreach ($field['choices'] as $key => $value) {
if (is_array($value)) {
foreach ($value as $child_key => $child_value) {
$field['choices'][$child_key] = $child_value;
}
unset($field['choices'][$key]);
}
}
}
break;
case 'slider':
$field['choices'] = array('min' => $field['min'], 'max' => $field['max'], 'step' => $field['step']);
break;
case 'spinner':
$field['type'] = 'number';
break;
case 'background':
case 'border':
case 'color_gradient':
case 'date':
case 'dimensions':
case 'divide':
case 'gallery':
case 'import_export':
case 'link_color':
case 'media':
case 'multi_text':
case 'password':
case 'section':
case 'select_image':
case 'sortable':
case 'sorter':
case 'spacing':
case 'spinner':
case 'switch':
case 'typography':
case 'slides':
// TODO
break;
}
Kirki::add_field($config_id, $field);
}
}
}
示例14: array
<?php
/**
* Header Layout
* ==============
*/
$section = 'header_layout';
$priority = 1;
Kirki::add_field('tm-polygon', array('type' => 'select', 'setting' => 'header_type', 'label' => esc_html__('Header Type', 'tm-polygon'), 'description' => esc_html__('Choose the header type you want', 'tm-polygon'), 'section' => $section, 'priority' => $priority++, 'default' => 'header01', 'choices' => array('header01' => 'Type 01', 'header02' => 'Type 02', 'header03' => 'Type 03', 'header04' => 'Type 04', 'header_blank' => 'Blank')));
Kirki::add_field('tm-polygon', array('type' => 'toggle', 'setting' => 'header_layout_search_enable', 'label' => esc_html__('Search box', 'tm-polygon'), 'description' => esc_html__('Turn on this option if you want to enable search box on your site', 'tm-polygon'), 'section' => $section, 'priority' => $priority++, 'default' => 1));
if (class_exists('WooCommerce')) {
Kirki::add_field('tm-polygon', array('type' => 'toggle', 'setting' => 'header_layout_mini_cart_enable', 'label' => esc_html__('Mini Cart', 'tm-polygon'), 'description' => esc_html__('Turn on this option if you want to enable mini cart for header', 'tm-polygon'), 'section' => $section, 'priority' => $priority++, 'default' => 1));
}
示例15: array
<?php
if (class_exists('Kirki')) {
Kirki::add_section('mailchimp', array('title' => __('Mailchimp'), 'description' => __('Tilføj API tilgang til mailchimp'), 'panel' => '', 'priority' => 160, 'capability' => 'edit_theme_options', 'theme_supports' => ''));
Kirki::add_field('mailchimp_api', array('settings' => 'mailchimp_api', 'label' => __('API nøgle', 'smamo'), 'section' => 'mailchimp', 'type' => 'text', 'priority' => 10, 'default' => '40bbbefd42e7b7fd5e22c5e0e9ca61b3-us10'));
Kirki::add_field('list_ID', array('settings' => 'list_ID', 'label' => __('Liste ID', 'smamo'), 'section' => 'mailchimp', 'type' => 'text', 'priority' => 10, 'default' => '51f08ecfa7'));
}