add_panel() public static méthode

Create a new panel.
public static add_panel ( string $id = '', array $args = [] )
$id string The ID for this panel.
$args array The panel arguments.
 public function test_add_panel()
 {
     Kirki::add_panel('test_empty', array());
     Kirki::add_panel('test', array('priority' => 4, 'title' => 'Title', 'description' => 'My Description'));
     $this->assertEquals(array('id' => 'test_empty', 'description' => '', 'priority' => 10, 'active_callback' => '__return_true'), Kirki::$panels['test_empty']);
     $this->assertEquals(array('id' => 'test', 'title' => 'Title', 'description' => 'My Description', 'priority' => '4', 'active_callback' => '__return_true'), Kirki::$panels['test']);
     $this->assertEquals(2, count(Kirki::$panels));
 }
Exemple #2
0
 public function add_panel()
 {
     Kirki::add_panel('panel_id', array('priority' => 10, 'title' => 'My Title', 'description' => 'My Description'));
 }
Exemple #3
0
if (class_exists('Kirki')) {
    /**
     * Add the configuration for the Daphnee Theme
     */
    Kirki::add_config('daphnee', array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod'));
    /*******************************
     * LAYOUT SECTION & OPTIONS
     ******************************/
    Kirki::add_section('layout', array('title' => __('Layout', 'daphnee'), 'description' => __('Configure your layout options', 'daphnee'), 'priority' => 10));
    Kirki::add_field('daphnee', array('type' => 'radio-image', 'settings' => 'layout', 'label' => __('Layout', 'daphnee'), 'section' => 'layout', 'default' => '', 'priority' => 10, 'choices' => array('full-screen' => trailingslashit(get_template_directory_uri()) . 'inc/kirki/assets/images/1c.png', 'left-sidebar' => trailingslashit(get_template_directory_uri()) . 'inc/kirki/assets/images/2cl.png', 'right-sidebar' => trailingslashit(get_template_directory_uri()) . 'inc/kirki/assets/images/2cr.png')));
    Kirki::add_field('daphnee', array('type' => 'slider', 'settings' => 'site_max_width', 'label' => __('Max Width', 'daphnee'), 'description' => __('Select the max-width for the main content area.', 'daphnee'), 'section' => 'layout', 'default' => 1020, 'priority' => 15, 'choices' => array('min' => 420, 'max' => 1600, 'step' => 1), 'output' => array(array('element' => '#content.row, #masthead .row', 'property' => 'max-width', 'units' => 'px')), 'transport' => 'postMessage', 'js_vars' => array(array('element' => '#content.row, #masthead .row', 'function' => 'css', 'property' => 'max-width', 'units' => 'px'))));
    Kirki::add_field('daphnee', array('type' => 'radio-buttonset', 'settings' => 'sidebar_width', 'label' => __('Sidebar Width (1-12 columns)', 'daphnee'), 'section' => 'layout', 'default' => '4', 'priority' => 10, 'choices' => array('3' => __('Narrow', 'daphnee'), '4' => __('Default', 'daphnee'), '5' => __('Wide', 'daphnee')), 'required' => array(array('setting' => 'layout', 'operator' => '!=', 'value' => 'full-screen'))));
    /*******************************
     * TYPOGRAPHY PANEL, SECTION & OPTIONS
     ******************************/
    Kirki::add_panel('typography', array('priority' => 11, 'title' => __('Typography', 'daphnee'), 'description' => __('Typography options for this site', 'daphnee')));
    Kirki::add_section('typography_base', array('title' => __('Base Typography', 'daphnee'), 'description' => __('Edit the global typography options for your site', 'dephnee'), 'panel' => 'typography'));
    Kirki::add_section('typography_headers', array('title' => __('Headers Typography', 'daphnee'), 'description' => __('Edit the headers typography options for your site', 'dephnee'), 'panel' => 'typography'));
    Kirki::add_field('daphnee', array('type' => 'slider', 'settings' => 'base_font_size', 'label' => __('Font Size', 'daphnee'), 'description' => __('Select the base font-size for your site. (The value below is in em\'s)', 'dephnee'), 'section' => 'typography_base', 'default' => 1, 'priority' => 1, 'choices' => array('min' => 0.6, 'max' => 3, 'step' => 0.01), 'output' => array(array('element' => 'body #primary, header#masthead', 'property' => 'font-size', 'units' => 'em')), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'body #primary, header#masthead', 'function' => 'css', 'property' => 'font-size', 'units' => 'em'))));
    Kirki::add_field('daphnee', array('type' => 'slider', 'settings' => 'base_font_size_side', 'label' => __('Sidebar Base Font Size', 'daphnee'), 'description' => __('Select the base font-size for your site. (The value below is in em\'s)', 'dephnee'), 'section' => 'typography_base', 'default' => 0.9, 'priority' => 1, 'choices' => array('min' => 0.6, 'max' => 3, 'step' => 0.01), 'output' => array(array('element' => 'body #secondary', 'property' => 'font-size', 'units' => 'em')), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'body #secondary', 'function' => 'css', 'property' => 'font-size', 'units' => 'em'))));
    Kirki::add_field('daphnee', array('type' => 'select2', 'settings' => 'base_font_family', 'label' => __('Font Family', 'daphnee'), 'section' => 'typography_base', 'default' => 'Roboto', 'priority' => 20, 'choices' => Kirki_Fonts::get_font_choices(), 'output' => array('element' => 'body', 'property' => 'font-family')));
    Kirki::add_field('daphnee', array('type' => 'multicheck', 'settings' => 'base_font_subsets', 'label' => __('Google-Font subsets', 'daphnee'), 'description' => __('The subsets used from Google\'s API.', 'daphnee'), 'section' => 'typography_base', 'default' => 'all', 'priority' => 22, 'choices' => Kirki_Fonts::get_google_font_subsets(), 'output' => array(array('element' => 'body', 'property' => 'font-subset'))));
    Kirki::add_field('daphnee', array('type' => 'slider', 'settings' => 'base_typography_font_weight', 'label' => __('Font Weight', 'daphnee'), 'section' => 'typography_base', 'default' => 300, 'priority' => 24, 'choices' => array('min' => 100, 'max' => 900, 'step' => 100), 'output' => array(array('element' => 'body', 'property' => 'font-weight'))));
    Kirki::add_field('daphnee', array('type' => 'slider', 'settings' => 'headers_font_size', 'label' => __('Font Size', 'daphnee'), 'description' => __('Select the base font-size for your site. This is the font-size of <h4> elements. The others are automatically calculated based on this value (the value below is in em\'s)', 'dephnee'), 'section' => 'typography_headers', 'default' => 1, 'priority' => 1, 'choices' => array('min' => 0.6, 'max' => 3, 'step' => 0.01), 'output' => array(array('element' => 'h1', 'property' => 'font-size', 'units' => 'em', 'sanitize_callback' => array('Daphnee_Customizer', 'h1_sanitize_size')), array('element' => 'h2', 'property' => 'font-size', 'units' => 'em', 'sanitize_callback' => array('Daphnee_Customizer', 'h2_sanitize_size')), array('element' => 'h3', 'property' => 'font-size', 'units' => 'em', 'sanitize_callback' => array('Daphnee_Customizer', 'h3_sanitize_size')), array('element' => 'h4', 'property' => 'font-size', 'units' => 'em', 'sanitize_callback' => array('Daphnee_Customizer', 'h4_sanitize_size')), array('element' => 'h5', 'property' => 'font-size', 'units' => 'em', 'sanitize_callback' => array('Daphnee_Customizer', 'h5_sanitize_size')), array('element' => 'h6', 'property' => 'font-size', 'units' => 'em', 'sanitize_callback' => array('Daphnee_Customizer', 'h6_sanitize_size')))));
    if (!Daphnee()->is_plus) {
        Kirki::add_field('daphnee', array('type' => 'custom', 'settings' => 'headers_typography_plus', 'label' => '', 'section' => 'typography_headers', 'default' => Daphnee_Customizer::update_info_wrapper(__('Plus Options', 'daphnee'), __('Get extra options for headers typography: Font family, separate font-size & font-weight per header (h1, h2, h3, h4, h5 & h6)', 'daphnee')), 'priority' => 99));
    }
    /*******************************
     * COLORS
     ******************************/
    Kirki::add_field('daphnee', array('type' => 'color', 'settings' => 'links_color', 'label' => __('Links Color', 'daphnee'), 'description' => __('Select the main color for your site\\s links', 'daphnee'), 'default' => '#00BCD4', 'section' => 'colors', 'output' => array(array('element' => 'a, a:visited, a:hover', 'property' => 'color')), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'a, a:visited, a:hover', 'function' => 'css', 'property' => 'color'))));
Exemple #4
0
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
     */
    Kirki::add_field('gannet_config', array('type' => 'slider', 'settings' => 'base_type_font_size', 'label' => __('Base Font Size', 'gannet'), 'section' => 'base_type', 'default' => 14, 'priority' => 25, 'choices' => array('min' => 12, 'max' => 30, 'step' => 1), 'output' => array(array('element' => 'body', 'property' => 'font-size', 'units' => 'px')), 'transport' => 'postMessage', 'js_vars' => array(array('element' => 'body', 'function' => 'css', 'property' => 'font-size', 'units' => 'px'))));
}
Exemple #5
0
<?php

/* Create Kirki Configuration */
function aptnews_kirki_configuration()
{
    return array('url_path' => get_stylesheet_directory_uri() . '/inc/kirki/');
}
add_filter('kirki/config', 'aptnews_kirki_configuration');
/* Turn off sanitization for input */
function do_not_filter_anything($value)
{
    return $value;
}
Kirki::add_config('my_config', array('option_type' => 'theme_mod', 'capability' => 'edit_theme_options'));
// Panel & Section & Field
Kirki::add_panel('frontpage_leftbar_panel', array('priority' => 10, 'title' => __('Home - Left Bar', 'aptnews'), 'description' => __('Customize left bar', 'aptnews')));
Kirki::add_section('frontpage_leftbar_tags_section', array('title' => __('Tags', 'aptnews'), 'panel' => 'frontpage_leftbar_panel', 'capability' => 'edit_theme_options', 'theme_supports' => ''));
Kirki::add_field('my_config', array('type' => 'text', 'settings' => 'frontpage_leftbar_tags_field', 'label' => __('Tags', 'aptnews'), 'description' => __('show most popular by given', 'aptnews'), 'section' => 'frontpage_leftbar_tags_section'));
<?php

if (class_exists('Kirki')) {
    /**
     * Add config
     */
    Kirki::add_config('my_theme', array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod'));
    /*
     * Add panel	
     */
    Kirki::add_panel('design', array('priority' => 10, 'title' => esc_attr__('Custom logo', 'twentysixteen-child-headerlogo')));
    /**
     * Add section
     */
    Kirki::add_section('logo', array('title' => esc_attr__('Replace site identity', 'twentysixteen-child-headerlogo'), 'priority' => 1, 'panel' => 'design', 'capability' => 'edit_theme_options'));
    /**
     * Add logo field
     */
    Kirki::add_field('my_theme', array('settings' => 'my_logo', 'label' => __('Choose your brand image', 'twentysixteen-child-headerlogo'), 'description' => __('Replace Twenty Sixteen site title and tagline with your custom logo', 'twentysixteen-child-headerlogo'), 'section' => 'logo', 'type' => 'upload', 'mime_type' => 'image', 'priority' => 10, 'default' => ''));
    /* Add SEO 'alt' tag on img element in DOM */
    Kirki::add_field('', array('type' => 'switch', 'settings' => 'logo_alt', 'label' => __('ALT tag?', 'twentysixteen-child-headerlogo'), 'description' => __('Add site tagline to logo ALT tag?', 'twentysixteen-child-headerlogo'), 'section' => 'logo', 'default' => '1', 'priority' => 20));
}
Exemple #7
0
 * ==============
 */
Kirki::add_config('infinity', array('option_type' => 'theme_mod', 'capability' => 'edit_theme_options'));
$priority = 1;
// Add panels
Kirki::add_panel('site', array('priority' => $priority++, 'title' => __('Site', 'infinity'), 'description' => __('My Description', 'infinity')));
Kirki::add_panel('top', array('priority' => $priority++, 'title' => __('Top Area', 'infinity'), 'description' => __('My Description', 'infinity')));
Kirki::add_panel('header', array('priority' => $priority++, 'title' => __('Header', 'infinity'), 'description' => __('My Description', 'infinity')));
Kirki::add_panel('nav', array('priority' => $priority++, 'title' => __('Navigation', 'infinity'), 'description' => __('My Description', 'infinity')));
Kirki::add_panel('button', array('priority' => $priority++, 'title' => __('Button', 'infinity'), 'description' => __('My Description', 'infinity')));
Kirki::add_panel('footer', array('priority' => $priority++, 'title' => __('Footer', 'infinity'), 'description' => __('My Description', 'infinity')));
Kirki::add_panel('copyright', array('priority' => $priority++, 'title' => __('Copyright', 'infinity'), 'description' => __('My Description', 'infinity')));
Kirki::add_panel('page', array('priority' => $priority++, 'title' => __('Page', 'infinity'), 'description' => __('My Description', 'infinity')));
Kirki::add_panel('post', array('priority' => $priority++, 'title' => __('Post', 'infinity'), 'description' => __('My Description', 'infinity')));
Kirki::add_panel('woo', array('priority' => $priority++, 'title' => __('Woocommerce', 'infinity'), 'description' => __('My Description', 'infinity')));
Kirki::add_panel('custom', array('priority' => $priority++, 'title' => __('Custom code', 'infinity'), 'description' => __('My Description', 'infinity')));
$priority = 1;
// Add sections for site panel
Kirki::add_section('site_general', array('title' => __('General', 'infinity'), 'description' => __('In this section you can control all general settings of your site', 'infinity'), 'panel' => 'site', 'priority' => $priority++));
Kirki::add_section('site_layouts', array('title' => __('Layouts', 'infinity'), 'description' => __('In this section you can control all layouts settings of your site', 'infinity'), 'panel' => 'site', 'priority' => $priority++));
Kirki::add_section('site_logo', array('title' => __('Logo', 'infinity'), 'description' => __('In this section you can control all logo settings of your site', 'infinity'), 'panel' => 'site', 'priority' => $priority++));
Kirki::add_section('site_favicon', array('title' => __('Favicon', 'infinity'), 'description' => __('In this section you can control all favicon settings of your site', 'infinity'), 'panel' => 'site', 'priority' => $priority++));
Kirki::add_section('site_color', array('title' => __('Color', 'infinity'), 'description' => __('In this section you can control all color settings of your site', 'infinity'), 'panel' => 'site', 'priority' => $priority++));
Kirki::add_section('site_style', array('title' => __('Style', 'infinity'), 'description' => __('In this section you can control all style settings of your site', 'infinity'), 'panel' => 'site', 'priority' => $priority++));
Kirki::add_section('background_image', array('title' => __('Background', 'infinity'), 'description' => __('In this section you can control all background settings of your site', 'infinity'), 'panel' => 'site', 'priority' => $priority++));
$priority = 1;
// Add sections for navigation panel
Kirki::add_section('nav', array('title' => __('Layout', 'infinity'), 'description' => __('In this section you can control all layout settings of navigation', 'infinity'), 'panel' => 'nav', 'priority' => $priority++));
Kirki::add_section('nav_style', array('title' => __('Style', 'infinity'), 'description' => __('In this section you can control all style settings of navigation', 'infinity'), 'panel' => 'nav', 'priority' => $priority++));
Kirki::add_section('nav_spacing', array('title' => __('Spacing', 'infinity'), 'description' => __('In this section you can control all spacing settings of navigation', 'infinity'), 'panel' => 'nav', 'priority' => $priority++));
Kirki::add_section('nav_border', array('title' => __('Border', 'infinity'), 'description' => __('In this section you can control all border settings of navigation', 'infinity'), 'panel' => 'nav', 'priority' => $priority++));
 *  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' => ''));
// Adding the Product Slider image 1 field
Kirki::add_field('mc', array('type' => 'image', 'settings' => 'product_slider_image_1', 'label' => __('Product Slider image 1', 'magnificient'), 'description' => __('This image will be the first image for the Product Slider.', 'magnificient'), 'section' => 'product_slider_for_homepage', 'default' => '', 'priority' => 10));
// Adding the Product Slider image 2 field
Exemple #9
0
<?php

/**
 * Customizer Panels
 *
 * @package FlatBook
 */
Kirki::add_panel('panel_general', array('priority' => 10, 'title' => __('General', 'flatbook')));
Kirki::add_panel('nav_menus', array('priority' => 20, 'title' => __('Menus', 'flatbook')));
Kirki::add_panel('panel_typography', array('priority' => 30, 'title' => __('Typography', 'flatbook')));
Kirki::add_panel('panel_colors', array('priority' => 40, 'title' => __('Colors', 'flatbook')));
Kirki::add_panel('panel_layout', array('priority' => 50, 'title' => __('Layout', 'flatbook')));
Kirki::add_panel('panel_pages', array('priority' => 60, 'title' => __('Pages', 'flatbook')));
Exemple #10
0
 /**
  *
  * Add new panel to customizer
  *
  * @throws \SilverWp\Customizer\Panel\Exception
  * @access private
  */
 private function addPanel()
 {
     if (!isset($this->panel_id)) {
         throw new Exception(Translate::translate('If You want add panel to your section first define panel_id class property.'));
     }
     $params = $this->createPanelParams();
     \Kirki::add_panel($this->panel_id, $params);
 }
Exemple #11
0
 */
Kirki::add_config('tm-polygon', array('option_type' => 'theme_mod', 'capability' => 'edit_theme_options'));
$priority = 1;
// Add panels
Kirki::add_panel('site', array('priority' => $priority++, 'title' => esc_html__('Site', 'tm-polygon'), 'description' => esc_html__('My Description', 'tm-polygon')));
Kirki::add_panel('top', array('priority' => $priority++, 'title' => esc_html__('Top Area', 'tm-polygon'), 'description' => esc_html__('My Description', 'tm-polygon')));
Kirki::add_panel('header', array('priority' => $priority++, 'title' => esc_html__('Header', 'tm-polygon'), 'description' => esc_html__('My Description', 'tm-polygon')));
Kirki::add_panel('nav', array('priority' => $priority++, 'title' => esc_html__('Navigation', 'tm-polygon'), 'description' => esc_html__('My Description', 'tm-polygon')));
Kirki::add_panel('button', array('priority' => $priority++, 'title' => esc_html__('Button', 'tm-polygon'), 'description' => esc_html__('My Description', 'tm-polygon')));
Kirki::add_panel('footer', array('priority' => $priority++, 'title' => esc_html__('Footer', 'tm-polygon'), 'description' => esc_html__('My Description', 'tm-polygon')));
Kirki::add_panel('copyright', array('priority' => $priority++, 'title' => esc_html__('Copyright', 'tm-polygon'), 'description' => esc_html__('My Description', 'tm-polygon')));
Kirki::add_panel('page', array('priority' => $priority++, 'title' => esc_html__('Page', 'tm-polygon'), 'description' => esc_html__('My Description', 'tm-polygon')));
Kirki::add_panel('shop', array('priority' => $priority++, 'title' => esc_html__('Shop', 'tm-polygon'), 'description' => esc_html__('My Description', 'tm-polygon')));
Kirki::add_panel('post', array('priority' => $priority++, 'title' => esc_html__('Post', 'tm-polygon'), 'description' => esc_html__('My Description', 'tm-polygon')));
Kirki::add_panel('woo', array('priority' => $priority++, 'title' => esc_html__('Woocommerce', 'tm-polygon'), 'description' => esc_html__('My Description', 'tm-polygon')));
Kirki::add_panel('custom', array('priority' => $priority++, 'title' => esc_html__('Custom code', 'tm-polygon'), 'description' => esc_html__('My Description', 'tm-polygon')));
$priority = 1;
// Add sections for site panel
Kirki::add_section('site_general', array('title' => esc_html__('General', 'tm-polygon'), 'description' => esc_html__('In this section you can control all general settings of your site', 'tm-polygon'), 'panel' => 'site', 'priority' => $priority++));
Kirki::add_section('site_layouts', array('title' => esc_html__('Layouts', 'tm-polygon'), 'description' => esc_html__('In this section you can control all layouts settings of your site', 'tm-polygon'), 'panel' => 'site', 'priority' => $priority++));
Kirki::add_section('site_logo', array('title' => esc_html__('Logo', 'tm-polygon'), 'description' => esc_html__('In this section you can control all logo settings of your site', 'tm-polygon'), 'panel' => 'site', 'priority' => $priority++));
Kirki::add_section('site_favicon', array('title' => esc_html__('Favicon', 'tm-polygon'), 'description' => esc_html__('In this section you can control all favicon settings of your site', 'tm-polygon'), 'panel' => 'site', 'priority' => $priority++));
Kirki::add_section('site_color', array('title' => esc_html__('Color', 'tm-polygon'), 'description' => esc_html__('In this section you can control all color settings of your site', 'tm-polygon'), 'panel' => 'site', 'priority' => $priority++));
Kirki::add_section('site_style', array('title' => esc_html__('Style', 'tm-polygon'), 'description' => esc_html__('In this section you can control all style settings of your site', 'tm-polygon'), 'panel' => 'site', 'priority' => $priority++));
Kirki::add_section('background_image', array('title' => esc_html__('Background', 'tm-polygon'), 'description' => esc_html__('In this section you can control all background settings of your site', 'tm-polygon'), 'panel' => 'site', 'priority' => $priority++));
if (version_compare($GLOBALS['wp_version'], '4.3', '>=')) {
    $panel = 'nav_menus';
} else {
    $panel = 'nav';
}
$priority = 1;
 Kirki::add_section('typography', array('title' => __('Font Settings', 'lathom'), 'description' => __('Configure Font Settings. You can also type the desired Font into the Select Box if you´re looking for a special one.', 'lathom'), 'panel' => '', 'priority' => 190, 'capability' => 'edit_theme_options'));
 Kirki::add_panel('topbar', array('priority' => 200, 'title' => __('Topbar', 'lathom'), 'description' => __('', 'lathom')));
 Kirki::add_section('topbar_features', array('title' => __('Topbar Features', 'lathom'), 'description' => __('Configure Settings for the Topbar', 'lathom'), 'panel' => 'topbar', 'priority' => 10, 'capability' => 'edit_theme_options'));
 Kirki::add_section('topbar_color_settings', array('title' => __('Topbar Colors', 'lathom'), 'description' => __('Configure Color Settings for the Topbar', 'lathom'), 'panel' => 'topbar', 'priority' => 20, 'capability' => 'edit_theme_options'));
 // Kirki::add_panel( 'menue', array(
 //     'priority'    => 210,
 //     'title'       => __( 'Offcanvas Menu Configuration', 'lathom' ),
 //     'description' => __( '', 'lathom' ),
 // ) );
 Kirki::add_section('menu_settings', array('title' => __('Offcanvas Menu Settings', 'lathom'), 'description' => __('', 'lathom'), 'panel' => '', 'priority' => 220, 'capability' => 'edit_theme_options'));
 Kirki::add_panel('content', array('priority' => 230, 'title' => __('Content Settings', 'lathom'), 'description' => __('My Description', 'lathom')));
 Kirki::add_section('content_features', array('title' => __('Content Features', 'lathom'), 'description' => __('', 'lathom'), 'panel' => 'content', 'priority' => 10, 'capability' => 'edit_theme_options'));
 Kirki::add_section('article_features', array('title' => __('Article Features', 'lathom'), 'description' => __('', 'lathom'), 'panel' => 'content', 'priority' => 15, 'capability' => 'edit_theme_options'));
 Kirki::add_section('article_colors', array('title' => __('Article Colors', 'lathom'), 'description' => __('', 'lathom'), 'panel' => 'content', 'priority' => 20, 'capability' => 'edit_theme_options'));
 Kirki::add_section('sidebar_colors', array('title' => __('Sidebar Configuration', 'lathom'), 'description' => __('Configure Sidebar Settings', 'lathom'), 'panel' => 'content', 'priority' => 30, 'capability' => 'edit_theme_options'));
 Kirki::add_panel('footer', array('priority' => 260, 'title' => __('Footer Configuration', 'lathom'), 'description' => __('', 'lathom')));
 Kirki::add_section('footerwidgets_settings', array('title' => __('Footer Widgets Settings', 'lathom'), 'description' => __('Configure Settings for the Footer Widgets Area', 'lathom'), 'panel' => 'footer', 'priority' => 10, 'capability' => 'edit_theme_options'));
 Kirki::add_section('footer_settings', array('title' => __('Footer Settings', 'lathom'), 'description' => __('Configure Settings for the Footer', 'lathom'), 'panel' => 'footer', 'priority' => 10, 'capability' => 'edit_theme_options'));
 Kirki::add_section('custom_code', array('title' => __('Custom Code', 'lathom'), 'description' => __('You can inject your own CSS and Javascript without modifying any of the theme files.', 'lathom'), 'panel' => '', 'priority' => 270, 'capability' => 'edit_theme_options'));
 /**
  * Add the configuration.
  * This way all the fields using the 'lathom' ID
  * will inherit these options
  */
 Kirki::add_config('lathom', array('capability' => 'edit_theme_options', 'option_type' => 'theme_mod'));
 /**
  * Font Settings
  */
 Kirki::add_field('base_typography', array('type' => 'typography', 'settings' => 'base_typography_config', 'label' => esc_attr__('Base Typography', 'lathom'), 'description' => esc_attr__('Configures the overall Font for the whole Site.', 'lathom'), 'help' => esc_attr__('', 'lathom'), 'section' => 'typography', 'default' => array('font-style' => array('bold', 'italic'), 'font-family' => 'Open Sans', 'font-size' => '16', 'font-weight' => '400', 'line-height' => '1.5', 'letter-spacing' => '-0.004', 'word-spacing' => '0.125'), 'priority' => 10, 'choices' => array('font-style' => true, 'font-family' => true, 'font-size' => true, 'font-weight' => true, 'line-height' => true, 'letter-spacing' => true, 'word-spacing' => true, 'units' => array('px', 'rem')), 'output' => array(array('element' => 'body'))));
 Kirki::add_field('headline_typography', array('type' => 'typography', 'settings' => 'headline_typography_config', 'label' => esc_attr__('Headline Typography', 'lathom'), 'description' => esc_attr__('Configures Headline Fonts for the Site.', 'lathom'), 'help' => esc_attr__('', 'lathom'), 'section' => 'typography', 'default' => array('font-style' => array('bold'), 'font-family' => 'Titillium Web', 'font-weight' => '800', 'letter-spacing' => '0.125', 'word-spacing' => '0.125'), 'priority' => 10, 'choices' => array('font-style' => true, 'font-family' => true, 'font-weight' => true, 'letter-spacing' => true, 'word-spacing' => true, 'units' => array('px', 'rem')), 'output' => array(array('element' => 'h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6'))));
 /**
<?php

/**
 * Add panels
 */
Kirki::add_panel('backgrounds', array('priority' => 10, 'title' => __('Backgrounds', 'ornea'), 'description' => __('Set background options for site areas', 'ornea')));
Kirki::add_panel('typography', array('priority' => 10, 'title' => __('Typography', 'ornea'), 'description' => __('Typography Options', 'ornea')));
Exemple #14
0
 /**
  * Set up the Kirki Customizer
  */
 public function setupKirkiCustomizer()
 {
     \Kirki::add_config($this->textdomain, array('capability' => 'edit_theme_options', 'option_type' => 'option'));
     add_filter('kirki/config', function ($config) {
         $config['styles_priority'] = 100000;
         return $config;
     });
     add_filter('kirki/control_types', function ($controls) {
         $controls['media'] = '\\WP_Customize_Media_Control';
         $controls['cropped_image'] = '\\WP_Customize_Cropped_Image_Control';
         return $controls;
     });
     $panels = $this->setting('customizer/panels', []);
     if (count($panels) > 0) {
         foreach ($panels as $key => $data) {
             \Kirki::add_panel($key, $data);
         }
     }
     $sections = $this->setting('customizer/sections', []);
     if (count($sections) > 0) {
         foreach ($sections as $key => $data) {
             \Kirki::add_section($key, $data);
         }
     }
     $settings = $this->setting('customizer/settings', []);
     if (count($settings) > 0) {
         foreach ($settings as $setting => $data) {
             $control = null;
             if (isset($data['control'])) {
                 $control = $data['control'];
                 unset($data['control']);
             }
             if ($control) {
                 $data = array_merge($data, $control);
             }
             $data['settings'] = $setting;
             \Kirki::add_field($this->textdomain, $data);
         }
     }
 }