本文整理汇总了PHP中Kirki::add_config方法的典型用法代码示例。如果您正苦于以下问题:PHP Kirki::add_config方法的具体用法?PHP Kirki::add_config怎么用?PHP Kirki::add_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kirki
的用法示例。
在下文中一共展示了Kirki::add_config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_field
public function test_field()
{
Kirki::add_config('test', array('capability' => 'manage_network_options', 'option_type' => 'option', 'option_name' => 'my_option_name', 'compiler' => array(), 'disable_output' => true, 'postMessage' => 'auto'));
Kirki::add_field('global', array('settings' => 'my_setting_global', 'label' => __('My custom control', 'translation_domain'), 'section' => 'my_section', 'type' => 'text', 'priority' => 10, 'default' => 'some-default-value'));
Kirki::add_field('test', array('settings' => 'my_setting_test', 'label' => __('My custom control', 'translation_domain'), 'section' => 'my_section', 'type' => 'text', 'priority' => 10, 'default' => 'some-default-value'));
$this->assertEquals(array('settings' => 'my_setting_global', 'label' => 'My custom control', 'section' => 'my_section', 'type' => 'kirki-generic', 'priority' => 10, 'default' => 'some-default-value', 'kirki_config' => 'global', 'option_name' => '', 'option_type' => 'theme_mod', 'capability' => 'edit_theme_options', 'disable_output' => false, 'tooltip' => '', 'active_callback' => '__return_true', 'choices' => array(), 'output' => array(), 'variables' => null, 'id' => 'my_setting_global', 'sanitize_callback' => 'wp_kses_post', 'choices' => array('element' => 'input', 'type' => 'text')), Kirki::$fields['my_setting_global']);
$this->assertEquals(array('settings' => 'my_option_name[my_setting_test]', 'label' => 'My custom control', 'section' => 'my_section', 'type' => 'kirki-generic', 'priority' => 10, 'default' => 'some-default-value', 'kirki_config' => 'test', 'option_name' => 'my_option_name', 'option_type' => 'option', 'capability' => 'manage_network_options', 'disable_output' => true, 'tooltip' => '', 'active_callback' => '__return_true', 'choices' => array(), 'output' => array(), 'variables' => null, 'id' => 'my_option_name-my_setting_test', 'sanitize_callback' => 'wp_kses_post', 'choices' => array('element' => 'input', 'type' => 'text')), Kirki::$fields['my_option_name[my_setting_test]']);
}
示例2: test_config
public function test_config()
{
Kirki::add_config('test_empty', array());
Kirki::add_config('test', array('capability' => 'manage_network_options', 'option_type' => 'option', 'option_name' => 'my_option_name', 'compiler' => array(), 'disable_output' => true, 'postMessage' => 'auto'));
$this->assertEquals(array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod', 'option_name' => '', 'compiler' => array(), 'disable_output' => false, 'postMessage' => ''), Kirki::$config['global']);
$this->assertEquals(array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod', 'option_name' => '', 'compiler' => array(), 'disable_output' => false, 'postMessage' => ''), Kirki::$config['test_empty']);
$this->assertEquals(array('capability' => 'manage_network_options', 'option_type' => 'option', 'option_name' => 'my_option_name', 'compiler' => array(), 'disable_output' => true, 'postMessage' => 'auto'), Kirki::$config['test']);
$this->assertEquals(3, count(Kirki::$config));
}
示例3: dirname
<?php
/* Load Kirki customizer framework */
include_once dirname(__FILE__) . '/options/kirki.php';
/* Early exit if Kirki is not installed */
if (!class_exists('Kirki')) {
return;
}
/* Register Kirki config */
Kirki::add_config('shamrock_settings', array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod'));
/* Header options */
Kirki::add_section('shamrock_header', array('priority' => 101, 'title' => __('Header', 'shamrock'), 'description' => __('These are setting for your website header/navigation area', 'shamrock')));
Kirki::add_field('shamrock_settings', array('type' => 'image', 'setting' => 'logo', 'label' => __('Logo', 'shamrock'), 'description' => __('Upload your logo', 'shamrock'), 'section' => 'shamrock_header', 'default' => ''));
Kirki::add_field('shamrock_settings', array('type' => 'checkbox', 'setting' => 'site_description', 'label' => __('Display site description', 'shamrock'), 'section' => 'shamrock_header', 'default' => 1));
Kirki::add_field('shamrock_settings', array('type' => 'checkbox', 'setting' => 'nav_social', 'label' => __('Include social icons in navigation', 'shamrock'), 'section' => 'shamrock_header', 'default' => 1));
Kirki::add_field('shamrock_settings', array('type' => 'checkbox', 'setting' => 'nav_search', 'label' => __('Include search in navigation', 'shamrock'), 'section' => 'shamrock_header', 'default' => 1));
/* General blog options */
Kirki::add_section('shamrock_blog', array('priority' => 101, 'title' => __('Blog', 'shamrock'), 'description' => __('These are general blog settings for your archive pages', 'shamrock')));
Kirki::add_field('shamrock_settings', array('type' => 'checkbox', 'setting' => 'rtl', 'label' => __('RTL mode', 'shamrock'), 'section' => 'shamrock_blog', 'default' => false));
Kirki::add_field('shamrock_settings', array('type' => 'radio', 'setting' => 'blog_layout', 'label' => __('Blog layout', 'shamrock'), 'section' => 'shamrock_blog', 'default' => 'sidebar', 'choices' => array('sidebar' => __('With Sidebar', 'shamrock'), 'classic' => __('Full Width (no sidebar)', 'shamrock'))));
Kirki::add_field('shamrock_settings', array('type' => 'checkbox', 'setting' => 'show_fimg', 'label' => __('Display featured image', 'shamrock'), 'section' => 'shamrock_blog', 'default' => 1));
Kirki::add_field('shamrock_settings', array('type' => 'image', 'setting' => 'default_fimg', 'label' => __('Deafult featured image', 'shamrock'), 'description' => __('Upload an image to display it for posts which don\'t have featured image set', 'shamrock'), 'section' => 'shamrock_blog', 'default' => '', 'required' => array(array('setting' => 'show_fimg', 'operator' => '==', 'value' => 1))));
Kirki::add_field('shamrock_settings', array('type' => 'checkbox', 'setting' => 'show_cat', 'label' => __('Display category', 'shamrock'), 'section' => 'shamrock_blog', 'default' => 1));
Kirki::add_field('shamrock_settings', array('type' => 'multicheck', 'setting' => 'meta', 'label' => __('Display post meta data', 'shamrock'), 'section' => 'shamrock_blog', 'default' => array('date', 'author', 'rtime', 'comments'), 'choices' => array('date' => __('Date', 'shamrock'), 'author' => __('Author', 'shamrock'), 'rtime' => __('Reading time', 'shamrock'), 'comments' => __('Comments', 'shamrock'))));
Kirki::add_field('shamrock_settings', array('type' => 'radio', 'setting' => 'content_type', 'label' => __('Content limit type', 'shamrock'), 'section' => 'shamrock_blog', 'default' => 'excerpt', 'choices' => array('content' => __('Manual (using <!--more--> tag)', 'shamrock'), 'excerpt' => __('Automatic (excerpt)', 'shamrock'))));
Kirki::add_field('shamrock_settings', array('type' => 'text', 'setting' => 'excerpt_length', 'label' => __('Excerpt length', 'shamrock'), 'description' => __('Specify your excerpt length (number of characters)', 'shamrock'), 'section' => 'shamrock_blog', 'default' => 230, 'required' => array(array('setting' => 'content_type', 'operator' => '==', 'value' => 'excerpt'))));
Kirki::add_field('shamrock_settings', array('type' => 'text', 'setting' => 'excerpt_more', 'label' => __('Excerpt "more" string', 'shamrock'), 'description' => __('Specify more string to append after excerpts', 'shamrock'), 'section' => 'shamrock_blog', 'default' => '...', 'required' => array(array('setting' => 'content_type', 'operator' => '==', 'value' => 'excerpt'))));
Kirki::add_field('shamrock_settings', array('type' => 'radio', 'setting' => 'pagination', 'label' => __('Pagination', 'shamrock'), 'section' => 'shamrock_blog', 'default' => 'numeric', 'choices' => array('numeric' => __('Numeric', 'shamrock'), 'classic' => __('Classic (prev/next)', 'shamrock'))));
/* Single post options */
Kirki::add_section('shamrock_single', array('priority' => 101, 'title' => __('Single Post', 'shamrock'), 'description' => __('These are settings which are applied to your single post template', 'shamrock')));
Kirki::add_field('shamrock_settings', array('type' => 'radio', 'setting' => 'single_layout', 'label' => __('Single posts layout', 'shamrock'), 'section' => 'shamrock_single', 'default' => 'sidebar', 'choices' => array('sidebar' => __('With Sidebar', 'shamrock'), 'classic' => __('Full Width (no sidebar)', 'shamrock'))));
示例4: gannet_kirki_init
function gannet_kirki_init()
{
Kirki::add_config('gannet_config', array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod'));
/**
* Header Panel
* - Header Image
* - Header Logo
*/
/**
* Header Text or Logo
*/
Kirki::add_field('gannet_config', array('type' => 'radio-buttonset', 'settings' => 'header_brand', 'label' => __('Show Header Text or Logo', 'gannet'), 'description' => __('Enable search functionality', 'gannet'), 'section' => 'title_tagline', 'priority' => 10, 'default' => 'text', 'choices' => array('text' => __('Header Text', 'gannet'), 'logo' => __('Logo', 'gannet'))));
/**
* Site Title Color
*/
Kirki::add_field('gannet_config', array('type' => 'color', 'label' => __('Site Title Color', 'gannet'), 'settings' => 'site_title_color', 'section' => 'title_tagline', 'default' => '#292929', 'priority' => 10, 'required' => array(array('setting' => 'header_brand', 'operator' => '==', 'value' => 'text')), 'output' => array(array('element' => '.site-title a', 'property' => 'color')), 'transport' => 'postMessage', 'js_vars' => array(array('element' => '.site-title a', 'function' => 'css', 'property' => 'color'))));
/**
* Site Tagline Color
*/
Kirki::add_field('gannet_config', array('type' => 'color', 'label' => __('Site Tagline Color', 'gannet'), 'settings' => 'site_tagline_color', 'section' => 'title_tagline', 'default' => '#7cccf9', 'priority' => 10, 'required' => array(array('setting' => 'header_brand', 'operator' => '==', 'value' => 'text')), 'output' => array(array('element' => '.site-description', 'property' => 'color')), 'transport' => 'postMessage', 'js_vars' => array(array('element' => '.site-description', 'function' => 'css', 'property' => 'color'))));
Kirki::add_field('gannet_config', array('type' => 'select', 'settings' => 'site_title_font_family', 'label' => __('Site title Font Family', 'gannet'), 'section' => 'title_tagline', 'default' => 'Roboto Condensed', 'priority' => 20, 'choices' => Kirki_Fonts::get_font_choices(), 'required' => array(array('setting' => 'header_brand', 'operator' => '==', 'value' => 'text')), 'output' => array(array('element' => '.site-branding .site-title a', 'property' => 'font-family')), 'transport' => 'postMessage', 'js_vars' => array(array('element' => '.site-branding .site-title a', 'function' => 'css', 'property' => 'font-family'))));
Kirki::add_field('gannet_config', array('type' => 'select', 'settings' => 'site_description_font_family', 'label' => __('Site Description Font Family', 'gannet'), 'section' => 'title_tagline', 'default' => 'Droid Serif', 'priority' => 20, 'choices' => Kirki_Fonts::get_font_choices(), 'required' => array(array('setting' => 'header_brand', 'operator' => '==', 'value' => 'text')), 'output' => array(array('element' => '.site-branding .site-description', 'property' => 'font-family')), 'transport' => 'postMessage', 'js_vars' => array(array('element' => '.site-branding .site-description', 'function' => 'css', 'property' => 'font-family'))));
Kirki::add_field('gannet_config', array('settings' => 'logo', 'label' => __('Upload Your Logo', 'gannet'), 'description' => __('We recommend a maximum logo size of 260 x 80 pixels', 'gannet'), 'section' => 'title_tagline', 'priority' => 20, 'type' => 'upload', 'required' => array(array('setting' => 'header_brand', 'operator' => '==', 'value' => 'logo'))));
Kirki::add_field('gannet_config', array('settings' => 'logo_retina', 'label' => __('Upload Your Retina Logo', 'gannet'), 'description' => __('The retina logo must be double the main logo resolution, so at our recommendation it would be 520 x 160 pixels', 'gannet'), 'section' => 'title_tagline', 'priority' => 20, 'type' => 'upload', 'required' => array(array('setting' => 'header_brand', 'operator' => '==', 'value' => 'logo'))));
/**
* Colors Panel
* - Skin (Premium)
* - Palettes (premium)
* - Background Color
* - Primary Color
* - Secondary Color
* - Headings Text Color
* - Body Text Color
*/
Kirki::add_field('gannet_config', array('type' => 'custom', 'label' => __('Skin', 'gannet'), 'description' => __('Choose between light or dark skins.', 'gannet'), 'settings' => 'skin_upsell', 'section' => 'colors', 'default' => gannet_upsell(__('This feature is only available in the premium version', 'gannet'))));
Kirki::add_field('gannet_config', array('type' => 'custom', 'label' => __('Palettes', 'gannet'), 'description' => __('Choose between a set of carefully crafted pallettes.', 'gannet'), 'settings' => 'palettes_upsell', 'section' => 'colors', 'default' => gannet_upsell(__('This feature is only available in the premium version', 'gannet'))));
/**
* Background Color
*/
Kirki::add_field('gannet_config', array('type' => 'color', 'label' => __('Background Color', 'gannet'), 'description' => __('Choose a background accent color.', 'gannet'), 'settings' => 'background_color', 'section' => 'colors', 'default' => '#f9f9f9', 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'body', 'function' => 'css', 'property' => 'background-color'))));
/**
* Primary Color
*/
Kirki::add_field('gannet_config', array('type' => 'color', 'label' => __('Primary Color', 'gannet'), 'description' => __('Choose a primary accent color.', 'gannet'), 'settings' => 'primary_color', 'section' => 'colors', 'default' => '#7bcaf7', 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'a, .site-branding .site-description', 'function' => 'css', 'property' => 'color'))));
/**
* Secondary Color
*/
Kirki::add_field('gannet_config', array('type' => 'color', 'label' => __('Secondary Color', 'gannet'), 'description' => __('Choose a secondary accent color.', 'gannet'), 'settings' => 'secondary_color', 'section' => 'colors', 'default' => '#f0b86f'));
Kirki::add_field('gannet_config', array('type' => 'color', 'label' => __('Heading Text Color', 'gannet'), 'description' => __('Choose a heading (h1 - h6) color.', 'gannet'), 'settings' => 'heading_text_color', 'section' => 'colors', 'default' => '#292929', 'js_vars' => array(array('element' => 'h1, h2, h3, h4, h5, h6', 'function' => 'css', 'property' => 'color'))));
Kirki::add_field('gannet_config', array('type' => 'color', 'label' => __('Body Text Color', 'gannet'), 'description' => __('Choose a body text color.', 'gannet'), 'settings' => 'body_text_color', 'section' => 'colors', 'default' => '#292929', 'js_vars' => array(array('element' => 'body', 'function' => 'css', 'property' => 'color'))));
/**
* Layout Section
*/
Kirki::add_section('layout', array('priority' => 90, 'title' => __('Layout & Design', 'gannet')));
Kirki::add_field('gannet_config', array('type' => 'custom', 'label' => __('Site Layout', 'gannet'), 'settings' => 'site_layout_upsell', 'section' => 'layout', 'default' => gannet_upsell(__('This feature is only available in the premium version', 'gannet'))));
Kirki::add_field('gannet_config', array('type' => 'custom', 'label' => __('Header Layout', 'gannet'), 'settings' => 'header_layout_upsell', 'section' => 'layout', 'default' => gannet_upsell(__('This feature is only available in the premium version', 'gannet'))));
Kirki::add_field('gannet_config', array('type' => 'switch', 'settings' => 'show_search', 'label' => __('Show Search', 'gannet'), 'description' => __('Enable search functionality', 'gannet'), 'help' => __('Displays/removes search icon in navigation and footer.', 'gannet'), 'section' => 'layout', 'priority' => 20, 'default' => '1', 'choices' => array('on' => __('On', 'gannet'), 'off' => __('Off', 'gannet'))));
/**
* Typography
*/
Kirki::add_panel('typography_panel', array('priority' => 90, 'title' => __('Typography', 'gannet')));
/**
* Heading Type
*/
Kirki::add_section('heading_type', array('title' => __('Headings', 'gannet'), 'panel' => 'typography_panel'));
Kirki::add_field('gannet_config', array('type' => 'select', 'settings' => 'heading_type_font_family', 'label' => __('Font Family', 'gannet'), 'section' => 'heading_type', 'default' => 'Open Sans', 'priority' => 20, 'choices' => Kirki_Fonts::get_font_choices(), 'output' => array(array('element' => 'h1, h2, h3, h4, h5, h6', 'property' => 'font-family')), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'h1, h2, h3, h4, h5, h6', 'function' => 'css', 'property' => 'font-family'))));
Kirki::add_field('gannet_config', array('type' => 'slider', 'settings' => 'heading_type_font_weight', 'label' => __('Font Weight', 'gannet'), 'section' => 'heading_type', 'default' => 600, 'priority' => 24, 'choices' => array('min' => 100, 'max' => 900, 'step' => 100), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'h1, h2, h3, h4, h5, h6', 'function' => 'css', 'property' => 'font-weight'))));
/**
* H1 Font Size
*/
Kirki::add_field('gannet_config', array('type' => 'slider', 'settings' => 'heading_type_h1_font_size', 'label' => __('H1 Font Size', 'gannet'), 'section' => 'heading_type', 'default' => 40, 'priority' => 25, 'choices' => array('min' => 22, 'max' => 60, 'step' => 1), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'h1', 'function' => 'css', 'property' => 'font-size', 'units' => 'px'))));
/**
* H2 Font Size
*/
Kirki::add_field('gannet_config', array('type' => 'slider', 'settings' => 'heading_type_h2_font_size', 'label' => __('H2 Font Size', 'gannet'), 'section' => 'heading_type', 'default' => 34, 'priority' => 25, 'choices' => array('min' => 20, 'max' => 50, 'step' => 1), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'h2', 'function' => 'css', 'property' => 'font-size', 'units' => 'px'))));
/**
* H3 Font Size
*/
Kirki::add_field('gannet_config', array('type' => 'slider', 'settings' => 'heading_type_h3_font_size', 'label' => __('H3 Font Size', 'gannet'), 'section' => 'heading_type', 'default' => 24, 'priority' => 25, 'choices' => array('min' => 26, 'max' => 48, 'step' => 1), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'h3', 'function' => 'css', 'property' => 'font-size', 'units' => 'px'))));
/**
* H4 Font Size
*/
Kirki::add_field('gannet_config', array('type' => 'slider', 'settings' => 'heading_type_h4_font_size', 'label' => __('H4 Font Size', 'gannet'), 'section' => 'heading_type', 'default' => 22, 'priority' => 25, 'choices' => array('min' => 16, 'max' => 40, 'step' => 1), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'h4', 'function' => 'css', 'property' => 'font-size', 'units' => 'px'))));
/**
* H5 Font Size
*/
Kirki::add_field('gannet_config', array('type' => 'slider', 'settings' => 'heading_type_h5_font_size', 'label' => __('H5 Font Size', 'gannet'), 'section' => 'heading_type', 'default' => 20, 'priority' => 25, 'choices' => array('min' => 14, 'max' => 40, 'step' => 1), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'h5', 'function' => 'css', 'property' => 'font-size', 'units' => 'px'))));
/**
* H6 Font Size
*/
Kirki::add_field('gannet_config', array('type' => 'slider', 'settings' => 'heading_type_h6_font_size', 'label' => __('H6 Font Size', 'gannet'), 'section' => 'heading_type', 'default' => 18, 'priority' => 25, 'choices' => array('min' => 12, 'max' => 30, 'step' => 1), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'h6', 'function' => 'css', 'property' => 'font-size', 'units' => 'px'))));
/**
* Base Typography
*/
Kirki::add_section('base_type', array('title' => __('Base', 'gannet'), 'panel' => 'typography_panel'));
Kirki::add_field('gannet_config', array('type' => 'select', 'settings' => 'base_type_font_family', 'label' => __('Font Family', 'gannet'), 'section' => 'base_type', 'default' => 'Open Sans', 'priority' => 20, 'choices' => Kirki_Fonts::get_font_choices(), 'transport' => 'postMessage', 'output' => array(array('element' => 'body', 'property' => 'font-family')), 'js_vars' => array(array('element' => 'body', 'function' => 'css', 'property' => 'font-family'))));
Kirki::add_field('gannet_config', array('type' => 'slider', 'settings' => 'base_type_font_weight', 'label' => __('Font Weight', 'gannet'), 'section' => 'base_type', 'default' => 300, 'priority' => 24, 'choices' => array('min' => 100, 'max' => 900, 'step' => 100), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'body', 'function' => 'css', 'property' => 'font-weight'))));
/**
* Base Font Size
*/
//.........这里部分代码省略.........
示例5: kirki_numeric_fields
*/
function kirki_numeric_fields($fields)
{
// step = 10
$fields[] = array('type' => 'slider', 'settings' => 'slider_demo', 'label' => __('This is the label', 'kirki'), 'description' => __('This is the control description', 'kirki'), 'help' => __('This is some extra help. You can use this to add some additional instructions for users. The main description should go in the "description" of the field, this is only to be used for help tips.', 'kirki'), 'section' => 'numeric', 'default' => 20, 'priority' => 10, 'choices' => array('min' => -100, 'max' => 100, 'step' => 10));
// step = 0.01
$fields[] = array('type' => 'slider', 'settings' => 'slider_demo_2', 'label' => __('This is the label', 'kirki'), 'description' => __('This is the control description', 'kirki'), 'help' => __('This is some extra help. You can use this to add some additional instructions for users. The main description should go in the "description" of the field, this is only to be used for help tips.', 'kirki'), 'section' => 'numeric', 'default' => 1.58, 'priority' => 20, 'choices' => array('min' => 0, 'max' => 5, 'step' => 0.01));
$fields[] = array('type' => 'number', 'settings' => 'number_demo', 'label' => __('This is the label', 'kirki'), 'description' => __('This is the control description', 'kirki'), 'help' => __('This is some extra help. You can use this to add some additional instructions for users. The main description should go in the "description" of the field, this is only to be used for help tips.', 'kirki'), 'section' => 'numeric', 'default' => '42', 'priority' => 10);
return $fields;
}
add_filter('kirki/fields', 'kirki_numeric_fields');
/**
* Create a config instance that will be used by fields added via the static methods.
* For this example we'll be defining our options to be serialized in the db, under the 'kirki_demo' option.
*/
Kirki::add_config('kirki_demo', array('options_type' => 'option', 'option_name' => 'kirki_demo'));
/**
* Create Custom field using the Kirki API static functions
*/
Kirki::add_field('kirki_demo', array('type' => 'custom', 'settings' => 'custom_demo', 'label' => __('This is the label', 'kirki'), 'description' => __('This is the control description', 'kirki'), 'help' => __('This is some extra help. You can use this to add some additional instructions for users. The main description should go in the "description" of the field, this is only to be used for help tips.', 'kirki'), 'section' => 'custom_section', 'default' => '<div style="padding: 30px;background-color: #333; color: #fff; border-radius: 50px;">You can enter custom markup in this control and use it however you want</div>', 'priority' => 10));
/**
* Create Color fields using the Kirki API static functions
*/
Kirki::add_field('kirki_demo', array('type' => 'color', 'settings' => 'color_demo', 'label' => __('Color Control', 'kirki'), 'description' => __('This is the control description', 'kirki'), 'help' => __('This is some extra help. You can use this to add some additional instructions for users.', 'kirki'), 'section' => 'color_section', 'default' => '#0088cc', 'priority' => 10, 'output' => array(array('element' => 'a, a:visited', 'property' => 'color', 'units' => ' !important'), array('element' => '#content', 'property' => 'border-color')), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'a, a:visited', 'function' => 'css', 'property' => 'color'), array('element' => '#content', 'function' => 'css', 'property' => 'background-color'))));
Kirki::add_field('kirki_demo', array('type' => 'color-alpha', 'settings' => 'color_alpha_demo', 'label' => __('Color-Alpha Control', 'kirki'), 'description' => __('This is the control description', 'kirki'), 'help' => __('This is some extra help. You can use this to add some additional instructions for users.', 'kirki'), 'section' => 'color_section', 'default' => '#0088cc', 'priority' => 10, 'output' => array(array('element' => 'a, a:visited', 'property' => 'color', 'units' => ' !important'), array('element' => '#content', 'property' => 'border-color')), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'a, a:visited', 'function' => 'css', 'property' => 'color'), array('element' => '#content', 'function' => 'css', 'property' => 'background-color'))));
/**
* Create Boolean fields using the Kirki API static functions
*/
// Checkbox
Kirki::add_field('kirki_demo', array('type' => 'checkbox', 'settings' => 'checkbox_demo_0', 'label' => __('This is the label', 'kirki'), 'description' => __('This is the control description', 'kirki'), 'help' => __('This is some extra help. You can use this to add some additional instructions for users.', 'kirki'), 'section' => 'boolean_controls', 'default' => 1, 'priority' => 10));
// Switch
示例6: kirki_hooks_init
function kirki_hooks_init()
{
Kirki::add_config('my_kirki_repeater', array('capability' => 'edit_theme_options', 'option_type' => 'option', 'option_name' => 'my_kirki_repeater'));
Kirki::add_section('my_kirki_repeater_section', array('title' => __('Kirki Repeater', 'kirki'), 'description' => __('Add custom CSS here', 'kirki'), 'panel' => '', 'priority' => 1, 'capability' => 'edit_theme_options', 'theme_supports' => ''));
}
示例7: my_theme_kirki_textdomain
<?php
function my_theme_kirki_textdomain()
{
$config['i18n']['add-new'] = esc_attr__('Tilføj', 'fagy');
return $config;
}
if (class_exists('Kirki')) {
add_filter('kirki/config', 'my_theme_kirki_textdomain');
// Config for kirki
Kirki::add_config('faaborg_gym', array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod'));
// Topbar
require 'topbar.php';
// Hero banner
require 'hero-banner.php';
// Footer
require 'footer.php';
// Facebook
require 'facebook.php';
}
示例8: add_config
public function add_config()
{
Kirki::add_config('my_config', array('option_type' => 'option', 'option_name' => 'my_option', 'capability' => 'edit_posts'));
Kirki::add_config('my_config2', array('option_type' => 'theme_mod', 'capability' => 'edit_posts'));
Kirki::add_config('my_config3', array('option_type' => 'option', 'capability' => 'edit_posts'));
}
示例9: define
define('WEFOSTER_CUSTOMIZER_URL', get_template_directory_uri());
}
// Our Mobile Devices Class that helps with loading responsive template parts and assets.
// We include this class because wp_is_mobile is unreliable in some cases.
if (!function_exists('wff_notphone') && !defined('WP_CLI')) {
require_once WEFOSTER_THEME_DIR . '/lib/vendor/Mobile-Detect/wp-mobile-detect.php';
}
/**
* Set up Kirki
*
* @since 1.0.0
*
*/
if (!defined('WEFOSTER_PLUS_PLUGIN_DIR')) {
require WEFOSTER_CUSTOMIZER_DIR . '/lib/vendor/kirki/kirki.php';
Kirki::add_config('wefoster_plus', array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod'));
}
/**
* $content_width is a global variable used by WordPress for max image upload sizes
* and media embeds (in pixels).
* @since 1.0.0
*
* Example: If the content area is 640px wide, set $content_width = 620; so images and videos will not overflow.
* Default: 1140px is the default Bootstrap container width.
*/
if (!isset($content_width)) {
$content_width = 1140;
}
/**
* Load our Files
*
示例10: add_config
public function add_config()
{
Kirki::add_config('my_config_theme_mods', array('option_type' => 'theme_mod', 'capability' => 'edit_posts'));
Kirki::add_config('my_config_options', array('option_type' => 'option', 'capability' => 'edit_posts'));
Kirki::add_config('my_config_options_serialized', array('option_type' => 'option', 'option_name' => 'my_option', 'capability' => 'edit_posts'));
}
示例11: get_template_directory
<?php
/* ------------------------------------------------------------------------- *
* This file contains the options for the theme.
/* ------------------------------------------------------------------------- */
// Integrating Kirki with our theme
include_once get_template_directory() . '/kirki/kirki.php';
// Adding the configuration
Kirki::add_config('mc', array('capability' => 'edit_theme_options', 'option_type' => 'option', 'option_name' => 'mc'));
// Adding the Product Slider panel
Kirki::add_panel('product_slider', array('priority' => 10, 'title' => __('Product Slider', 'magnificient'), 'description' => __('A slider to show the products', 'magnificient')));
// Adding the Product Description panel
Kirki::add_panel('product_description', array('priority' => 10, 'title' => __('Product Description', 'magnificient'), 'description' => __('Panels to show description of the products', 'magnificient')));
// Adding the Product Details panel
Kirki::add_panel('product_details', array('priority' => 10, 'title' => __('Product Details', 'magnificient'), 'description' => __('Panels to show details of the products', 'magnificient')));
// Adding the Team Showcase panel
Kirki::add_panel('team_showcase', array('priority' => 10, 'title' => __('Team Showcase', 'magnificient'), 'description' => __('A section to show your team', 'magnificient')));
// Adding the Frontpage Separate Page Content panel
Kirki::add_panel('front_page_separate_page_content', array('priority' => 10, 'title' => __('Frontpage Separate Page Content', 'magnificient'), 'description' => __('A section to fetch content from another page', 'magnificient')));
// Adding the Product Slider for Homepage section
Kirki::add_section('product_slider_for_homepage', array('title' => __('Product Slider for Homepage', 'magnificient'), 'description' => __('This slider will be shown on the front page of your website', 'magnificient'), 'panel' => 'product_slider', 'priority' => 160, 'capability' => 'edit_theme_options', 'theme_supports' => ''));
// Adding the Product Images for Homepage section
Kirki::add_section('product_images_for_homepage', array('title' => __('Product Images for Homepage', 'magnificient'), 'description' => __('These images will be shown on the product description panels on the front page of your website', 'magnificient'), 'panel' => 'product_description', 'priority' => 160, 'capability' => 'edit_theme_options', 'theme_supports' => ''));
// Adding the Product Description for Homepage section
Kirki::add_section('product_description_for_homepage', array('title' => __('Product Description for Homepage', 'magnificient'), 'description' => __('These panels will be shown on the front page of your website', 'magnificient'), 'panel' => 'product_description', 'priority' => 160, 'capability' => 'edit_theme_options', 'theme_supports' => ''));
// Adding the Product Details for Homepage section
Kirki::add_section('product_details_for_homepage', array('title' => __('Product Details for Homepage', 'magnificient'), 'description' => __('This will show the details on the front page of your website', 'magnificient'), 'panel' => 'product_details', 'priority' => 160, 'capability' => 'edit_theme_options', 'theme_supports' => ''));
// Adding the Team Showcase for Homepage section
Kirki::add_section('team_showcase_for_homepage', array('title' => __('Team Showcase for Homepage', 'magnificient'), 'description' => __('This will show the team members on the front page of your website', 'magnificient'), 'panel' => 'team_showcase', 'priority' => 160, 'capability' => 'edit_theme_options', 'theme_supports' => ''));
// Adding the Frontpage Separate Page Content for Homepage section
Kirki::add_section('front_page_separate_page_content_for_homepage', array('title' => __('Frontpage Separate Page Content for Homepage', 'magnificient'), 'description' => __('This will show the separate page content on the front page of your website', 'magnificient'), 'panel' => 'front_page_separate_page_content', 'priority' => 160, 'capability' => 'edit_theme_options', 'theme_supports' => ''));
示例12: array
// Early exit if Kirki is not installed
if (!class_exists('Kirki')) {
return;
}
/**
* Create panels using the Kirki API.
*/
Kirki::add_section('site_general', array('priority' => 10, 'title' => __('General', 'beagency'), 'description' => __('You may need to refresh the page to see the changes.', 'beagency')));
Kirki::add_section('site_homepage', array('priority' => 20, 'title' => __('Homepage', 'beagency'), 'description' => __('Here you can customize your homepage.', 'beagency'), 'active_callback' => 'is_front_page'));
Kirki::add_section('site_404_page', array('priority' => 30, 'title' => __('404 Page', 'beagency'), 'description' => __('Here you can customize your 404 Page.', 'beagency'), 'active_callback' => 'is_404'));
Kirki::add_section('site_footer', array('priority' => 120, 'title' => __('Site Footer', 'beagency'), 'description' => __('Here you can customize the footer on your site.', 'beagency')));
Kirki::add_section('upgrade_theme', array('priority' => 130, 'title' => __('Upgrade', 'beagency')));
/**
* Create a config instance that will be used by fields added via the static methods.
*/
Kirki::add_config('beagency_kirki', array('option_type' => 'theme_mod'));
/**
* Create fields using the Kirki API static functions.
*/
Kirki::add_field('beagency_kirki', array('type' => 'text', 'settings' => 'general_site_title', 'label' => __('Site Title', 'beagency'), 'section' => 'site_general', 'default' => get_bloginfo('name'), 'priority' => 10, 'transport' => 'postMessage', 'js_vars' => array(array('element' => '.site-title a', 'function' => 'html', 'property' => 'text'))));
Kirki::add_field('beagency_kirki', array('type' => 'dropdown-pages', 'settings' => 'general_front_page', 'label' => __('Front Page', 'beagency'), 'help' => __('Create a blank page with Home Page template and set it as Front Page.', 'beagency'), 'section' => 'site_general', 'default' => get_option('page_on_front'), 'priority' => 20));
Kirki::add_field('beagency_kirki', array('type' => 'dropdown-pages', 'settings' => 'general_posts_page', 'label' => __('Posts Page', 'beagency'), 'help' => __('Create a blank page and set it as Posts Page.', 'beagency'), 'section' => 'site_general', 'default' => get_option('page_for_posts'), 'priority' => 30));
Kirki::add_field('beagency_kirki', array('type' => 'checkbox', 'settings' => 'general_sticky_menu', 'label' => __('Enable Sticky Menu?', 'beagency'), 'help' => __('If enable, the menu will be accessible from anywhere without having to scroll.', 'beagency'), 'section' => 'site_general', 'default' => '1', 'priority' => 40));
Kirki::add_field('beagency_kirki', array('type' => 'checkbox', 'settings' => 'general_go_to_top', 'label' => __('Enable Go to Top Button?', 'beagency'), 'section' => 'site_general', 'default' => '1', 'priority' => 50));
Kirki::add_field('beagency_kirki', array('type' => 'checkbox', 'settings' => 'homepage_heading', 'label' => __('Enable Heading Block?', 'beagency'), 'section' => 'site_homepage', 'default' => '1', 'priority' => 10));
Kirki::add_field('beagency_kirki', array('type' => 'textarea', 'settings' => 'homepage_heading_h1', 'label' => __('Heading', 'beagency'), 'help' => __('If you want to color the word, just wrap it with \\"span\\" tag.', 'beagency'), 'section' => 'site_homepage', 'default' => 'Hello, We are <span>BeTheme</span>. We <span><i class="fa fa-heart-o"></i></span> WordPress!', 'priority' => 20, 'required' => array(array('setting' => 'homepage_heading', 'operator' => '==', 'value' => 1))));
Kirki::add_field('beagency_kirki', array('type' => 'textarea', 'settings' => 'homepage_heading_span', 'label' => __('Content', 'beagency'), 'section' => 'site_homepage', 'default' => 'We handcraft well-thought-out WordPress themes built on solid coding and elegant design.', 'priority' => 30, 'required' => array(array('setting' => 'homepage_heading', 'operator' => '==', 'value' => 1))));
Kirki::add_field('beagency_kirki', array('type' => 'checkbox', 'settings' => 'homepage_image', 'label' => __('Enable Header Image?', 'beagency'), 'section' => 'site_homepage', 'default' => '0', 'priority' => 40));
Kirki::add_field('beagency_kirki', array('type' => 'image', 'settings' => 'homepage_image_url', 'label' => __('Current Header Image', 'beagency'), 'section' => 'site_homepage', 'default' => '', 'priority' => 50, 'required' => array(array('setting' => 'homepage_image', 'operator' => '==', 'value' => 1))));
Kirki::add_field('beagency_kirki', array('type' => 'text', 'settings' => 'homepage_portfolio_title', 'label' => __('Portfolio Block Title', 'beagency'), 'help' => __('If you want to color the word, just wrap it with \\"span\\" tag.', 'beagency'), 'section' => 'site_homepage', 'default' => 'Our <span>Latest</span> Works', 'priority' => 60));
Kirki::add_field('beagency_kirki', array('type' => 'checkbox', 'settings' => 'homepage_blog', 'label' => __('Enable Blog Block?', 'beagency'), 'section' => 'site_homepage', 'default' => '1', 'priority' => 70));
示例13: array
<?php
if (class_exists('Kirki')) {
Kirki::add_config('smamo_conf', array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod'));
Kirki::add_config('smamo_business_info', array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod'));
require 'kirki/info.php';
}
示例14: test_sanitize_config_id
/**
* Test sanitize_config_id
*/
public function test_sanitize_config_id()
{
// Define invalid config IDs. should return 'global'.
$this->assertEquals('global', Kirki_Field::sanitize_config_id('foo', array('kirki_config' => 'bar')));
$this->assertEquals('global', Kirki_Field::sanitize_config_id(array()));
Kirki::add_config('foo');
Kirki::add_config('bar');
$this->assertEquals('bar', Kirki_Field::sanitize_config_id('foo', array('kirki_config' => 'bar')));
$this->assertEquals('foo', Kirki_Field::sanitize_config_id('foo', array()));
$this->assertEquals('global', Kirki_Field::sanitize_config_id('', array()));
$this->assertEquals('global', Kirki_Field::sanitize_config_id());
}
示例15: array
<?php
Kirki::add_config('smamo_conf', array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod'));
Kirki::add_config('smamo_business_info', array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod'));
Kirki::add_config('smamo_logo', array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod'));
Kirki::add_config('smamo_front_video', array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod'));
require 'kirki/info.php';
require 'kirki/logo.php';
require 'kirki/video.php';