Skip to content

Instantly share code, notes, and snippets.

@EnricoRipalti
Created May 25, 2015 11:53
Show Gist options
  • Save EnricoRipalti/7c9de01283bc0e04050d to your computer and use it in GitHub Desktop.
Save EnricoRipalti/7c9de01283bc0e04050d to your computer and use it in GitHub Desktop.
Theme customizer setting with the Old API
<?php
/**
* Handles the init and hooks to the customize_register action
*
* @author Enrico Ripalti
*
* @param WP_Customize_Manager $wp_customize: The WP_Customize_Manager instance
* @hooked customize_register
*/
function commlyCustomizerInit( $wp_customize ) {
global $woo_options, $alloptions;
$alloptions = wp_load_alloptions();
/**
* Add panels
*/
$wp_customize->add_panel( 'cm_fonts', array(
'priority' => 10,
'title' => __( 'Fonts', 'commly-admin' ),
'description' => __( 'Define all things fonts, including families, sizes, colours and a lot more', 'commly-admin' ),
) );
$wp_customize->add_panel( 'cm_header_footer', array(
'priority' => 15,
'title' => __( 'Header & Footer', 'commly-admin' ),
'description' => __( 'Change background, border and margins of the header and the footer', 'commly-admin' ),
) );
$wp_customize->add_panel( 'cm_panel_products', array(
'priority' => 20,
'title' => __( 'Products', 'commly-admin' ),
'description' => __( 'Define style, features and appearance of products', 'commly-admin' ),
) );
$wp_customize->add_panel( 'kirki_controls', array(
'priority' => 10,
'title' => __( 'Kirki Custom Controls', 'ornea' ),
'description' => __( 'This panel contains the Kirki custom controls', 'kirki' ),
) );
/**
* Add sections
*/
$wp_customize->add_section( 'cm_navigation_misc', array(
'title' => __( 'Navigation misc.', 'commly-admin' ),
'priority' => 10,
//'panel' => 'default_controls',
'description' => __( 'Control different aspects of the other means of navigation in your site', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_font_families', array(
'title' => __( 'Font families', 'commly-admin' ),
'priority' => 10,
'panel' => 'cm_fonts',
'description' => __( 'Choose the font families (types) to be used thorughout your website', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_product_archives', array(
'title' => __( 'Product archives', 'commly-admin' ),
'priority' => 10,
'panel' => 'cm_panel_products',
'description' => __( 'Customize appearance of product categories, brand views, search result and any other aggregate view of products', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_logo', array(
'title' => __( 'Logo', 'commly-admin' ),
'priority' => 10,
//'panel' => 'default_controls',
'description' => __( 'Upload your logo and change its properties', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_top_menu', array(
'title' => __( 'Top Menu', 'commly-admin' ),
'priority' => 10,
//'panel' => 'default_controls',
'description' => __( 'Change top menu appearance and edit welcome message and phone no.', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_fonts_navigation', array(
'title' => __( 'Navigation', 'commly-admin' ),
'priority' => 10,
'panel' => 'cm_fonts',
//'description' => __( 'Change font', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_fonts_titles', array(
'title' => __( 'Products, pages and posts titles', 'commly-admin' ),
'priority' => 20,
'panel' => 'cm_fonts',
//'description' => __( 'Change font', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_fonts_footer', array(
'title' => __( 'Footer', 'commly-admin' ),
'priority' => 40,
'panel' => 'cm_fonts',
//'description' => __( 'Change font', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_fonts_h1', array(
'title' => __( 'Heading 1 (H1)', 'commly-admin' ),
'priority' => 10,
'panel' => 'cm_fonts',
'description' => __( 'Font properties for "Heading 1" text', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_fonts_h2', array(
'title' => __( 'Heading 2 (H2)', 'commly-admin' ),
'priority' => 10,
'panel' => 'cm_fonts',
'description' => __( 'Font properties for "Heading 2" text', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_fonts_h3', array(
'title' => __( 'Heading 3 (H3)', 'commly-admin' ),
'priority' => 10,
'panel' => 'cm_fonts',
'description' => __( 'Font properties for "Heading 3" text', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_fonts_h4', array(
'title' => __( 'Heading 4 (H4)', 'commly-admin' ),
'priority' => 10,
'panel' => 'cm_fonts',
'description' => __( 'Font properties for "Heading 4" text', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_fonts_h5', array(
'title' => __( 'Heading 5 (H5)', 'commly-admin' ),
'priority' => 10,
'panel' => 'cm_fonts',
'description' => __( 'Font properties for "Heading 5" text', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_fonts_h6', array(
'title' => __( 'Heading 6 (H6)', 'commly-admin' ),
'priority' => 10,
'panel' => 'cm_fonts',
'description' => __( 'Font properties for "Heading 6" text', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_header', array(
'title' => __( 'Header', 'commly-admin' ),
'priority' => 10,
'panel' => 'cm_header_footer',
'description' => __( 'Customize the header of your store', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_footer', array(
'title' => __( 'Footer', 'commly-admin' ),
'priority' => 20,
'panel' => 'cm_header_footer',
'description' => __( 'Customize the footer of your store', 'commly-admin' ),
) );
$wp_customize->add_section( 'cm_after_footer', array(
'title' => __( 'Footer', 'commly-admin' ),
'priority' => 30,
'panel' => 'cm_header_footer',
'description' => __( 'Add notices at the bottom of the page, right below the footer', 'commly-admin' ),
) );
/*
* --- Add controls
*/
$wp_customize->add_setting( 'woo_options[cm_logoAlignment]', array(
// TODO controllare che il valore della woo_option esista, altrimenti viene restituito un notice WP_DEBUG
'default' => isset($woo_options['cm_logoAlignment']) ? $woo_options['cm_logoAlignment'] : maybe_unserialize($alloptions['cm_logoAlignment']),
'type' => 'woo',
'capability' => 'edit_theme_options',
) );
$wp_customize->add_control( 'cm_logoAlignment', array(
'label' => __( 'Logo alignment', 'commly-admin' ),
'section' => 'cm_logo',
'settings' => 'woo_options[cm_logoAlignment]',
'type' => 'radio',
'choices' => array(
'left' => 'Align left',
'center' => 'Align center',
'right' => 'Align right',
),
) );
$wp_customize->add_setting( 'woo_options[cm_numberOfColumnsWooCommerceArchives]', array(
'default' => isset($woo_options['cm_numberOfColumnsWooCommerceArchives']) ? $woo_options['cm_numberOfColumnsWooCommerceArchives'] : maybe_unserialize($alloptions['cm_numberOfColumnsWooCommerceArchives']),
'type' => 'woo',
'capability' => 'edit_theme_options',
) );
$wp_customize->add_control( 'cm_numberOfColumnsWooCommerceArchives', array(
'label' => __( 'Number of product per row', 'commly-admin' ),
'section' => 'cm_product_archives',
'settings' => 'woo_options[cm_numberOfColumnsWooCommerceArchives]',
'type' => 'select',
'choices' => array(
'2' => '2 X',
'3' => '3 X',
'4' => '4 X',
),
) );
$wp_customize->add_setting( 'woo_options[cm_topMenuAlignment]', array(
'default' => isset($woo_options['cm_topMenuAlignment']) ? $woo_options['cm_topMenuAlignment'] : maybe_unserialize($alloptions['cm_topMenuAlignment']),
'type' => 'woo',
'capability' => 'edit_theme_options',
) );
$wp_customize->add_control( 'cm_topMenuAlignment', array(
'label' => __( 'Top menu alignment', 'commly-admin' ),
'section' => 'cm_top_menu',
'settings' => 'woo_options[cm_topMenuAlignment]',
'type' => 'select',
'choices' => array(
'fl' => 'Left',
'rl' => 'Right'
)
) );
// Removes the default navigation section
$wp_customize->remove_section('nav');
// woo_header_full_width
}
add_action( 'customize_register', 'commlyCustomizerInit' );
function customKirkiControls($controls) {
global $woo_options, $alloptions;
if (isset($woo_options['woo_breadcrumbs_show'])) {
$controls[] = array(
'type' => 'toggle',
'options_type' => 'woo',
'setting' => 'woo_options[woo_breadcrumbs_show]',
'label' => __( 'Show breadcrumb?', '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' => 'cm_navigation_misc',
'default' => $woo_options['woo_breadcrumbs_show'] == 'true' ? 1 : 0,
'priority' => 10
);}else{
$controls[] = array(
'type' => 'toggle',
'options_type' => 'woo',
'setting' => 'woo_options[woo_breadcrumbs_show]',
'label' => __( 'Show breadcrumb?', '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' => 'cm_navigation_misc',
'default' => 0,
'priority' => 10
);
}
// TODO: Aggiungere un help per i controlli dei font che spieghi esattamente quali sono gli elementi interessati
$currentDefault = maybe_unserialize($alloptions['woo_font_h1']);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo',
'setting' => 'woo_options[titles_fonts]',
'multiSettings' => array("woo_options[woo_font_h1][face]", "woo_options[woo_font_h2][face]", "woo_options[woo_font_h3][face]", "woo_options[woo_widget_font_title][face]", "woo_options[woo_archive_header_font][face]", "woo_options[woo_font_logo][face]", "woo_options[woo_font_post_title][face]"),
'label' => __( 'Titles font', 'commly-admin' ),
'description' => __( 'Set the font family for titles', 'commly-admin' ),
'section' => 'cm_font_families',
'default' => isset($woo_options['woo_font_h1']['face']) ? $woo_options['woo_font_h1']['face'] : $currentDefault['face'],
'multiSetting' => true,
'priority' => 19,
'choices' => Kirki_Fonts::get_font_choices(),
'transport' => 'refresh',
);
$currentDefault = maybe_unserialize($alloptions['woo_font_text']);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo',
'setting' => 'woo_options[body_fonts]',
'multiSettings' => array('woo_font_text[face]', 'woo_font_post_text[face]', 'woo_font_h4[face]', 'woo_font_h5[face]', 'woo_font_h6[face]', 'woo_nav_font[face]', 'woo_widget_font_text[face]', 'woo_widget_tabs_font[face]', 'woo_widget_tabs_font_meta[face]', 'woo_footer_font[face]', 'woo_top_nav_font[face]' ),
'label' => __( 'Body font', 'commly-admin' ),
'description' => __( 'Set the font family for body, texts and descriptions', 'commly-admin' ),
'section' => 'cm_font_families',
'default' => isset($woo_options['woo_font_text']['face']) ? $woo_options['woo_font_text']['face'] : $currentDefault['face'],
'multiSetting' => true,
'priority' => 20,
'choices' => Kirki_Fonts::get_font_choices(),
'transport' => 'refresh',
);
$currentDefault = maybe_unserialize($alloptions['woo_font_desc']);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo',
'setting' => 'woo_options[other_fonts]',
'multiSettings' => array('woo_font_desc[face]', 'woo_font_post_meta[face]', 'woo_font_post_more[face]', 'woo_pagenav_font[face]' ),
'label' => __( 'Other fonts', 'commly-admin' ),
'description' => __( 'Fonts used for page navigation and meta info', 'commly-admin' ),
'section' => 'cm_font_families',
'default' => isset($woo_options['woo_font_desc']['face']) ? $woo_options['woo_font_text']['face'] : $currentDefault['face'],
'multiSetting' => true,
'priority' => 21,
'choices' => Kirki_Fonts::get_font_choices(),
'transport' => 'refresh',
);
$controls[] = array(
'type' => 'text',
'options_type' => 'woo',
'setting' => 'woo_options[cm_topMenuAddText]',
'label' => __( 'Welcome message', 'commly-admin' ),
//'description' => __( 'This is the control description', 'commly-admin' ),
'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.', 'commly-admin' ),
'section' => 'cm_top_menu',
'default' => isset($woo_options['cm_topMenuAddText']) ? $woo_options['cm_topMenuAddText'] : '',
'priority' => 10,
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'li#cm_topMenuAddText span',
'function' => 'html',
//'property' => 'font-size',
),
)
);
$controls[] = array(
'type' => 'text',
'options_type' => 'woo',
'setting' => 'woo_options[cm_topMenuPhoneNumber]',
'label' => __( 'Top menu phone no.', 'commly-admin' ),
//'description' => __( 'This is the control description', 'commly-admin' ),
'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.', 'commly-admin' ),
'section' => 'cm_top_menu',
'default' => isset($woo_options['cm_topMenuPhoneNumber']) ? $woo_options['cm_topMenuPhoneNumber'] : '',
'priority' => 10,
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'li#cm_topMenuPhoneNumber span',
'function' => 'html',
//'property' => 'font-size',
),
)
);
$currentDefault = maybe_unserialize($alloptions['woo_nav_font']);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_nav_font][size]',
'label' => __( 'Font Size', 'commly-admin' ),
'section' => 'cm_fonts_navigation',
'default' => $woo_options['woo_nav_font']['size'] ? $woo_options['woo_nav_font']['size'] : $currentDefault['size'],
'priority' => 24,
'choices' => array(
'min' => 10,
'max' => 18,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'output' => array(
'element' => 'ul#main-nav li a',
'property' => 'font-size',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'ul#main-nav li a',
'function' => 'css',
'property' => 'font-size',
),
/*array(
'element' => 'h1, h2, h3, h4',
'function' => 'css',
'property' => 'font-family',
),*/
)
);
$currentDefault = maybe_unserialize($alloptions['woo_font_post_title']);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_font_post_title][size]',
'label' => __( 'Size', 'commly-admin' ),
'section' => 'cm_fonts_titles',
'default' => isset($woo_options['woo_font_post_title']['size']) ? $woo_options['woo_font_post_title']['size'] : $currentDefault['size'],
'priority' => 24,
'choices' => array(
'min' => 16,
'max' => 36,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'output' => array(
'element' => '.entry-title',
'property' => 'font-size',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '.entry-title',
'function' => 'css',
'property' => 'font-size',
),
)
);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_post_title][style]',
'label' => __( 'Style', 'commly-admin' ),
'section' => 'cm_fonts_titles',
// TODO: una roba tipo getalloption potrebbe tornare utile per dare cmq un valore di default anche quando questo non è presente in $woo_options (lo prenderei dalle righe singole)
'default' => isset($woo_options['woo_font_post_title']['style']) ? $woo_options['woo_font_post_title']['style'] : $currentDefault['style'],
'priority' => 25,
'choices' => array(
'300' => __( 'Thin', 'commly-admin' ),
'normal' => __( 'Regular', 'commly-admin' ),
'bold' => __( 'Bold', 'commly-admin' ),
),
'output' => array(
'element' => '.entry-title',
'property' => 'font-weight',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '.entry-title',
'function' => 'css',
'property' => 'font-weight',
),
)
);
$controls[] = array(
'type' => 'color',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_post_title][color]',
'label' => __( 'Color', 'commly-admin' ),
'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.', 'commly-admin' ),
'section' => 'cm_fonts_titles',
'default' => isset($woo_options['woo_font_post_title']['color']) ? $woo_options['woo_font_post_title']['color'] : $currentDefault['color'],
'priority' => 26,
'output' => array(
array(
'element' => '.entry-title',
'property' => 'color',
'units' => ' !important'
),
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '.entry-title',
'function' => 'css',
'property' => 'color',
),
)
);
/* ################################################################################ */
/* ################################################################################ */
/* ## ## */
/* ###### FONTS ###### */
/* ## ## */
/* ################################################################################ */
/* ################################################################################ */
/* ######################################## */
/* ## ## */
/* ###### TITLES FONTS ###### */
/* ## ## */
/* ######################################## */
$currentDefault = maybe_unserialize($alloptions['woo_font_h1']);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_font_h1][size]',
'label' => __( 'Size', 'commly-admin' ),
'section' => 'cm_fonts_h1',
'default' => isset($woo_options['woo_font_h1']['size']) ? $woo_options['woo_font_h1']['size'] : $currentDefault['size'],
'priority' => 24,
'choices' => array(
'min' => 16,
'max' => 36,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'output' => array(
'element' => 'h1',
'property' => 'font-size',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h1',
'function' => 'css',
'property' => 'font-size',
),
)
);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_h1][style]',
'label' => __( 'Style', 'commly-admin' ),
'section' => 'cm_fonts_h1',
'default' => isset($woo_options['woo_font_h1']['style']) ? $woo_options['woo_font_h1']['style'] : $currentDefault['style'],
'priority' => 25,
'choices' => array(
'300' => __( 'Thin', 'commly-admin' ),
'normal' => __( 'Regular', 'commly-admin' ),
'bold' => __( 'Bold', 'commly-admin' ),
),
'output' => array(
'element' => 'h1',
'property' => 'font-weight',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h1',
'function' => 'css',
'property' => 'font-weight',
),
)
);
$controls[] = array(
'type' => 'color',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_h1][color]',
'label' => __( 'Color', 'commly-admin' ),
'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.', 'commly-admin' ),
'section' => 'cm_fonts_h1',
'default' => isset($woo_options['woo_font_h1']['color']) ? $woo_options['woo_font_h1']['color'] : $currentDefault['color'],
'priority' => 26,
'output' => array(
array(
'element' => 'h1',
'property' => 'color',
'units' => ' !important'
),
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h1',
'function' => 'css',
'property' => 'color',
),
)
);
$currentDefault = maybe_unserialize($alloptions['woo_font_h2']);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_font_h2][size]',
'label' => __( 'Size', 'commly-admin' ),
'section' => 'cm_fonts_h2',
'default' => isset($woo_options['woo_font_h2']['size']) ? $woo_options['woo_font_h2']['size'] : $currentDefault['size'],
'priority' => 24,
'choices' => array(
'min' => 16,
'max' => 36,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'output' => array(
'element' => 'h2',
'property' => 'font-size',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h2',
'function' => 'css',
'property' => 'font-size',
),
)
);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_h2][style]',
'label' => __( 'Style', 'commly-admin' ),
'section' => 'cm_fonts_h2',
'default' => isset($woo_options['woo_font_h2']['style']) ? $woo_options['woo_font_h2']['style'] : $currentDefault['style'],
'priority' => 25,
'choices' => array(
'300' => __( 'Thin', 'commly-admin' ),
'normal' => __( 'Regular', 'commly-admin' ),
'bold' => __( 'Bold', 'commly-admin' ),
),
'output' => array(
'element' => 'h2',
'property' => 'font-weight',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h2',
'function' => 'css',
'property' => 'font-weight',
),
)
);
$controls[] = array(
'type' => 'color',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_h2][color]',
'label' => __( 'Color', 'commly-admin' ),
'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.', 'commly-admin' ),
'section' => 'cm_fonts_h2',
'default' => isset($woo_options['woo_font_h2']['color']) ? $woo_options['woo_font_h2']['color'] : $currentDefault['color'],
'priority' => 26,
'output' => array(
array(
'element' => 'h2',
'property' => 'color',
'units' => ' !important'
),
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h2',
'function' => 'css',
'property' => 'color',
),
)
);
$currentDefault = maybe_unserialize($alloptions['woo_font_h3']);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_font_h3][size]',
'label' => __( 'Size', 'commly-admin' ),
'section' => 'cm_fonts_h3',
'default' => isset($woo_options['woo_font_h3']['size']) ? $woo_options['woo_font_h3']['size'] : $currentDefault['size'],
'priority' => 24,
'choices' => array(
'min' => 16,
'max' => 36,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'output' => array(
'element' => 'h3',
'property' => 'font-size',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h3',
'function' => 'css',
'property' => 'font-size',
),
)
);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_h3][style]',
'label' => __( 'Style', 'commly-admin' ),
'section' => 'cm_fonts_h3',
'default' => isset($woo_options['woo_font_h3']['style']) ? $woo_options['woo_font_h3']['style'] : $currentDefault['style'],
'priority' => 25,
'choices' => array(
'300' => __( 'Thin', 'commly-admin' ),
'normal' => __( 'Regular', 'commly-admin' ),
'bold' => __( 'Bold', 'commly-admin' ),
),
'output' => array(
'element' => 'h3',
'property' => 'font-weight',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h3',
'function' => 'css',
'property' => 'font-weight',
),
)
);
$controls[] = array(
'type' => 'color',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_h3][color]',
'label' => __( 'Color', 'commly-admin' ),
'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.', 'commly-admin' ),
'section' => 'cm_fonts_h3',
'default' => isset($woo_options['woo_font_h3']['color']) ? $woo_options['woo_font_h3']['color'] : $currentDefault['color'],
'priority' => 26,
'output' => array(
array(
'element' => 'h3',
'property' => 'color',
'units' => ' !important'
),
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h3',
'function' => 'css',
'property' => 'color',
),
)
);
$currentDefault = maybe_unserialize($alloptions['woo_font_h4']);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_font_h4][size]',
'label' => __( 'Size', 'commly-admin' ),
'section' => 'cm_fonts_h4',
'default' => isset($woo_options['woo_font_h4']['size']) ? $woo_options['woo_font_h4']['size'] : $currentDefault['size'],
'priority' => 24,
'choices' => array(
'min' => 16,
'max' => 36,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'output' => array(
'element' => 'h4',
'property' => 'font-size',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h4',
'function' => 'css',
'property' => 'font-size',
),
)
);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_h4][style]',
'label' => __( 'Style', 'commly-admin' ),
'section' => 'cm_fonts_h4',
'default' => isset($woo_options['woo_font_h4']['style']) ? $woo_options['woo_font_h4']['style'] : $currentDefault['style'],
'priority' => 25,
'choices' => array(
'300' => __( 'Thin', 'commly-admin' ),
'normal' => __( 'Regular', 'commly-admin' ),
'bold' => __( 'Bold', 'commly-admin' ),
),
'output' => array(
'element' => 'h4',
'property' => 'font-weight',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h4',
'function' => 'css',
'property' => 'font-weight',
),
)
);
$controls[] = array(
'type' => 'color',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_h4][color]',
'label' => __( 'Color', 'commly-admin' ),
'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.', 'commly-admin' ),
'section' => 'cm_fonts_h4',
'default' => isset($woo_options['woo_font_h4']['color']) ? $woo_options['woo_font_h4']['color'] : $currentDefault['color'],
'priority' => 26,
'output' => array(
array(
'element' => 'h4',
'property' => 'color',
'units' => ' !important'
),
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h4',
'function' => 'css',
'property' => 'color',
),
)
);
$currentDefault = maybe_unserialize($alloptions['woo_font_h5']);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_font_h5][size]',
'label' => __( 'Size', 'commly-admin' ),
'section' => 'cm_fonts_h5',
'default' => isset($woo_options['woo_font_h5']['size']) ? $woo_options['woo_font_h5']['size'] : $currentDefault['size'],
'priority' => 24,
'choices' => array(
'min' => 16,
'max' => 36,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'output' => array(
'element' => 'h5',
'property' => 'font-size',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h5',
'function' => 'css',
'property' => 'font-size',
),
)
);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_h5][style]',
'label' => __( 'Style', 'commly-admin' ),
'section' => 'cm_fonts_h5',
'default' => isset($woo_options['woo_font_h5']['style']) ? $woo_options['woo_font_h5']['style'] : $currentDefault['style'],
'priority' => 25,
'choices' => array(
'300' => __( 'Thin', 'commly-admin' ),
'normal' => __( 'Regular', 'commly-admin' ),
'bold' => __( 'Bold', 'commly-admin' ),
),
'output' => array(
'element' => 'h5',
'property' => 'font-weight',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h5',
'function' => 'css',
'property' => 'font-weight',
),
)
);
$controls[] = array(
'type' => 'color',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_h5][color]',
'label' => __( 'Color', 'commly-admin' ),
'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.', 'commly-admin' ),
'section' => 'cm_fonts_h5',
'default' => isset($woo_options['woo_font_h5']['color']) ? $woo_options['woo_font_h5']['color'] : $currentDefault['color'],
'priority' => 26,
'output' => array(
array(
'element' => 'h5',
'property' => 'color',
'units' => ' !important'
),
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h5',
'function' => 'css',
'property' => 'color',
),
)
);
$currentDefault = maybe_unserialize($alloptions['woo_font_h6']);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_font_h6][size]',
'label' => __( 'Size', 'commly-admin' ),
'section' => 'cm_fonts_h6',
'default' => isset($woo_options['woo_font_h6']['size']) ? $woo_options['woo_font_h6']['size'] : $currentDefault['size'],
'priority' => 24,
'choices' => array(
'min' => 16,
'max' => 36,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'output' => array(
'element' => 'h6',
'property' => 'font-size',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h6',
'function' => 'css',
'property' => 'font-size',
),
)
);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_h6][style]',
'label' => __( 'Style', 'commly-admin' ),
'section' => 'cm_fonts_h6',
'default' => isset($woo_options['woo_font_h6']['style']) ? $woo_options['woo_font_h6']['style'] : $currentDefault['style'],
'priority' => 25,
'choices' => array(
'300' => __( 'Thin', 'commly-admin' ),
'normal' => __( 'Regular', 'commly-admin' ),
'bold' => __( 'Bold', 'commly-admin' ),
),
'output' => array(
'element' => 'h6',
'property' => 'font-weight',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h6',
'function' => 'css',
'property' => 'font-weight',
),
)
);
$controls[] = array(
'type' => 'color',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_font_h6][color]',
'label' => __( 'Color', 'commly-admin' ),
'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.', 'commly-admin' ),
'section' => 'cm_fonts_h6',
'default' => isset($woo_options['woo_font_h6']['color']) ? $woo_options['woo_font_h6']['color'] : $currentDefault['color'],
'priority' => 26,
'output' => array(
array(
'element' => 'h6',
'property' => 'color',
'units' => ' !important'
),
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h6',
'function' => 'css',
'property' => 'color',
),
)
);
/* ######################################## */
/* ## ## */
/* ###### FOOTER FONTS ###### */
/* ## ## */
/* ######################################## */
$currentDefault = maybe_unserialize($alloptions['woo_footer_font']);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_footer_font][size]',
'label' => __( 'Size', 'commly-admin' ),
'section' => 'cm_fonts_footer',
'default' => isset($woo_options['woo_footer_font']['size']) ? $woo_options['woo_footer_font']['size'] : $currentDefault['size'],
'priority' => 10,
'choices' => array(
'min' => 11,
'max' => 19,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#footer, #footer p',
'function' => 'css',
'property' => 'font-size',
),
)
);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_footer_font][style]',
'label' => __( 'Style', 'commly-admin' ),
'section' => 'cm_fonts_footer',
'default' => isset($woo_options['woo_footer_font']['style']) ? $woo_options['woo_footer_font']['style'] : $currentDefault['style'],
'priority' => 11,
'choices' => array(
'300' => __( 'Thin', 'commly-admin' ),
'normal' => __( 'Regular', 'commly-admin' ),
'bold' => __( 'Bold', 'commly-admin' ),
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#footer, #footer p',
'function' => 'css',
'property' => 'font-weight',
),
)
);
$controls[] = array(
'type' => 'color',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_footer_font][color]',
'label' => __( 'Color', 'commly-admin' ),
//'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.', 'commly-admin' ),
'section' => 'cm_fonts_footer',
'default' => isset($woo_options['woo_footer_font']['color']) ? $woo_options['woo_footer_font']['color'] : $currentDefault['color'],
'priority' => 12,
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#footer, #footer p',
'function' => 'css',
'property' => 'color',
),
)
);
/* ######################################## */
/* ## ## */
/* ###### HEADER ###### */
/* ## ## */
/* ######################################## */
$controls[] = array(
'type' => 'color-alpha',
'setting' => 'woo_options[woo_header_bg]',
'label' => __( 'Background color', 'commly-admin' ),
//'description' => __( 'The', 'kirki' ),
//'help' => __( 'This is some extra help.', 'kirki' ),
'section' => 'cm_header',
'default' => isset($woo_options['woo_header_bg']) ? $woo_options['woo_header_bg'] : maybe_unserialize($alloptions['woo_header_bg']),
'priority' => 10,
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#header',
'function' => 'css',
'property' => 'background-color',
),
)
);
// TODO: la rimozione dell'immagine tramite "remove image" dopo che si era anche impsotato il bg color da un'errore alla :41 di sanitize.php in kirki
$controls[] = array(
'type' => 'image',
'options_type' => 'woo',
'setting' => 'woo_options[woo_header_bg_image]',
'label' => __( 'Background image', 'commly-admin' ),
//'description' => __( 'This is the control description', 'kirki' ),
'help' => __( 'This is some extra help.', 'commly-admin' ),
'section' => 'cm_header',
'default' => isset($woo_options['woo_header_bg_image']) ? $woo_options['woo_header_bg_image'] : maybe_unserialize($alloptions['woo_header_bg_image']),
'priority' => 15,
);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo',
'setting' => 'woo_options[woo_header_bg_image_repeat]',
'label' => __( 'Background repeat', 'commly-admin' ),
'section' => 'cm_header',
'default' => isset($woo_options['woo_header_bg_image_repeat']) ? $woo_options['woo_header_bg_image_repeat'] : maybe_unserialize($alloptions['woo_header_bg_image_repeat']),
'priority' => 16,
'choices' => array(
'no-repeat' => __( 'Don\'t repeat', 'commly-admin' ),
'repeat' => __( 'Tile', 'commly-admin' ),
'repeat-x' => __( 'Tile horizontally', 'commly-admin' ),
'repeat-y' => __( 'Tile vertically', 'commly-admin' ),
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#header',
'function' => 'css',
'property' => 'background-repeat',
),
)
);
$currentDefault = maybe_unserialize($alloptions['woo_header_border']);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_header_border][width]',
'label' => __( 'Border width', 'commly-admin' ),
'section' => 'cm_header',
'default' => isset($woo_options['woo_header_border']['width']) ? $woo_options['woo_header_border']['width'] : $currentDefault['width'],
'priority' => 20,
'choices' => array(
'min' => 0,
'max' => 10,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#header',
'function' => 'css',
'property' => 'border-width',
),
)
);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_header_border][style]',
'label' => __( 'Border style', 'commly-admin' ),
'section' => 'cm_header',
'default' => isset($woo_options['woo_header_border']['style']) ? $woo_options['woo_header_border']['style'] : $currentDefault['style'],
'priority' => 20,
'choices' => array(
'solid' => __( 'Solid', 'commly-admin' ),
'dashed' => __( 'Dashed', 'commly-admin' ),
'dotted' => __( 'Dotted', 'commly-admin' ),
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#header',
'function' => 'css',
'property' => 'border-style',
),
)
);
$controls[] = array(
'type' => 'color-alpha',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_header_border][color]',
'label' => __( 'Border color', 'commly-admin' ),
//'description' => __( 'The', 'kirki' ),
//'help' => __( 'This is some extra help.', 'kirki' ),
'section' => 'cm_header',
'default' => isset($woo_options['woo_header_border']['color']) ? $woo_options['woo_header_border']['color'] : $currentDefault['color'],
'priority' => 25,
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#header',
'function' => 'css',
'property' => 'border-color',
),
)
);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_header_margin_top]',
'label' => __( 'Margin from top', 'commly-admin' ),
'section' => 'cm_header',
'default' => isset($woo_options['woo_header_margin_top']) ? $woo_options['woo_header_margin_top'] : maybe_unserialize($alloptions['woo_header_margin_top']),
'priority' => 30,
'choices' => array(
'min' => 0,
'max' => 50,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#header',
'function' => 'css',
'property' => 'margin-top',
),
)
);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_header_margin_bottom]',
'label' => __( 'Margin from bottom', 'commly-admin' ),
'section' => 'cm_header',
'default' => isset($woo_options['woo_header_margin_bottom']) ? $woo_options['woo_header_margin_bottom'] : maybe_unserialize($alloptions['woo_header_margin_bottom']),
'priority' => 31,
'choices' => array(
'min' => 0,
'max' => 50,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#header',
'function' => 'css',
'property' => 'margin-bottom',
),
)
);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_header_padding_top]',
'label' => __( 'Margin from top', 'commly-admin' ),
'section' => 'cm_header',
'default' => isset($woo_options['woo_header_padding_top']) ? $woo_options['woo_header_padding_top'] : maybe_unserialize($alloptions['woo_header_padding_top']),
'priority' => 35,
'choices' => array(
'min' => 0,
'max' => 50,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#header',
'function' => 'css',
'property' => 'padding-top',
),
)
);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_header_padding_bottom]',
'label' => __( 'Margin from bottom', 'commly-admin' ),
'section' => 'cm_header',
'default' => isset($woo_options['woo_header_padding_bottom']) ? $woo_options['woo_header_padding_bottom'] : maybe_unserialize($alloptions['woo_header_padding_bottom']),
'priority' => 36,
'choices' => array(
'min' => 0,
'max' => 50,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#header',
'function' => 'css',
'property' => 'padding-bottom',
),
)
);
/* ######################################## */
/* ## ## */
/* ###### FOOTER ###### */
/* ## ## */
/* ######################################## */
$controls[] = array(
'type' => 'color-alpha',
'setting' => 'woo_options[woo_footer_bg]',
'label' => __( 'Background color', 'commly-admin' ),
//'description' => __( 'The', 'kirki' ),
//'help' => __( 'This is some extra help.', 'kirki' ),
'section' => 'cm_footer',
'default' => isset($woo_options['woo_footer_bg']) ? $woo_options['woo_footer_bg'] : maybe_unserialize($alloptions['woo_footer_bg']),
'priority' => 10,
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#footer',
'function' => 'css',
'property' => 'background-color',
),
)
);
$currentDefault = maybe_unserialize($alloptions['woo_footer_border_top']);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_footer_border_top][width]',
'label' => __( 'Top Border width', 'commly-admin' ),
'section' => 'cm_footer',
'default' => isset($woo_options['woo_footer_border_top']['width']) ? $woo_options['woo_footer_border_top']['width'] : $currentDefault['width'],
'priority' => 20,
'choices' => array(
'min' => 0,
'max' => 10,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#footer',
'function' => 'css',
'property' => 'border-top-width',
),
)
);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_footer_border_top][style]',
'label' => __( 'Top Border style', 'commly-admin' ),
'section' => 'cm_footer',
'default' => isset($woo_options['woo_footer_border_top']['style']) ? $woo_options['woo_footer_border_top']['style'] : $currentDefault['style'],
'priority' => 21,
'choices' => array(
'solid' => __( 'Solid', 'commly-admin' ),
'dashed' => __( 'Dashed', 'commly-admin' ),
'dotted' => __( 'Dotted', 'commly-admin' ),
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#footer',
'function' => 'css',
'property' => 'border-top-style',
),
)
);
$controls[] = array(
'type' => 'color-alpha',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_footer_border_top][color]',
'label' => __( 'Top Border color', 'commly-admin' ),
//'description' => __( 'The', 'kirki' ),
//'help' => __( 'This is some extra help.', 'kirki' ),
'section' => 'cm_footer',
'default' => isset($woo_options['woo_footer_border_top']['color']) ? $woo_options['woo_footer_border_top']['color'] : $currentDefault['color'],
'priority' => 22,
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#footer',
'function' => 'css',
'property' => 'border-top-color',
),
)
);
$currentDefault = maybe_unserialize($alloptions['woo_footer_border_bottom']);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_footer_border_bottom][width]',
'label' => __( 'Bottom Border width', 'commly-admin' ),
'section' => 'cm_footer',
'default' => isset($woo_options['woo_footer_border_bottom']['width']) ? $woo_options['woo_footer_border_bottom']['width'] : $currentDefault['width'],
'priority' => 30,
'choices' => array(
'min' => 0,
'max' => 10,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#footer',
'function' => 'css',
'property' => 'border-bottom-width',
),
)
);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_footer_border_bottom][style]',
'label' => __( 'Bottom Border style', 'commly-admin' ),
'section' => 'cm_footer',
'default' => isset($woo_options['woo_footer_border_bottom']['style']) ? $woo_options['woo_footer_border_bottom']['style'] : $currentDefault['style'],
'priority' => 31,
'choices' => array(
'solid' => __( 'Solid', 'commly-admin' ),
'dashed' => __( 'Dashed', 'commly-admin' ),
'dotted' => __( 'Dotted', 'commly-admin' ),
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#footer',
'function' => 'css',
'property' => 'border-bottom-style',
),
)
);
$controls[] = array(
'type' => 'color-alpha',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_footer_border_bottom][color]',
'label' => __( 'Bottom Border color', 'commly-admin' ),
//'description' => __( 'The', 'kirki' ),
//'help' => __( 'This is some extra help.', 'kirki' ),
'section' => 'cm_footer',
'default' => isset($woo_options['woo_footer_border_bottom']['color']) ? $woo_options['woo_footer_border_bottom']['color'] : $currentDefault['color'],
'priority' => 32,
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#footer',
'function' => 'css',
'property' => 'border-bottom-color',
),
)
);
$currentDefault = maybe_unserialize($alloptions['woo_footer_border_lr']);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_footer_border_lr][width]',
'label' => __( 'Left and right border width', 'commly-admin' ),
'section' => 'cm_footer',
'default' => isset($woo_options['woo_footer_border_lr']['width']) ? $woo_options['woo_footer_border_lr']['width'] : $currentDefault['width'],
'priority' => 40,
'choices' => array(
'min' => 0,
'max' => 10,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'transport' => 'refresh',
);
$controls[] = array(
'type' => 'select',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_footer_border_lr][style]',
'label' => __( 'Left and right Border style', 'commly-admin' ),
'section' => 'cm_footer',
'default' => isset($woo_options['woo_footer_border_lr']['style']) ? $woo_options['woo_footer_border_lr']['style'] : $currentDefault['style'],
'priority' => 41,
'choices' => array(
'solid' => __( 'Solid', 'commly-admin' ),
'dashed' => __( 'Dashed', 'commly-admin' ),
'dotted' => __( 'Dotted', 'commly-admin' ),
),
'transport' => 'refresh',
);
$controls[] = array(
'type' => 'color-alpha',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_footer_border_lr][color]',
'label' => __( 'Left and right border color', 'commly-admin' ),
//'description' => __( 'The', 'kirki' ),
//'help' => __( 'This is some extra help.', 'kirki' ),
'section' => 'cm_footer',
'default' => isset($woo_options['woo_footer_border_lr']['color']) ? $woo_options['woo_footer_border_lr']['color'] : $currentDefault['color'],
'priority' => 42,
'transport' => 'refresh',
);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo',
'setting' => 'woo_options[woo_footer_border_radius]',
'label' => __( 'Round corners', 'commly-admin' ),
'section' => 'cm_footer',
'default' => isset($woo_options['woo_footer_border_radius']) ? filter_var($woo_options['woo_footer_border_radius'], FILTER_SANITIZE_NUMBER_INT) : filter_var(maybe_unserialize($alloptions['woo_footer_border_radius']), FILTER_SANITIZE_NUMBER_INT),
'priority' => 45,
'choices' => array(
'min' => 0,
'max' => 20,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '#footer',
'function' => 'css',
'property' => 'border-radius',
),
)
);
if (isset($woo_options['woo_footer_left'])) {
$controls[] = array(
'type' => 'toggle',
'options_type' => 'woo',
'setting' => 'woo_options[woo_footer_left]',
'label' => __( 'Show left notice?', 'commly-admin' ),
//'description' => __( 'This is the control description', 'kirki' ),
'help' => __( 'Enable this to add the text below to bottom of the footer', 'commly-admin' ),
'section' => 'cm_after_footer',
'default' => $woo_options['woo_footer_left'] == 'true' ? 1 : 0,
'priority' => 10
);}else{
$controls[] = array(
'type' => 'toggle',
'options_type' => 'woo',
'setting' => 'woo_options[woo_footer_left]',
'label' => __( 'Show left notice?', 'commly-admin' ),
//'description' => __( 'This is the control description', 'kirki' ),
'help' => __( 'Enable this to add the text below to bottom of the footer', 'commly-admin' ),
'section' => 'cm_after_footer',
'default' => 0,
'priority' => 10
);
}
$controls[] = array(
'type' => 'color',
'options_type' => 'woo2d',
'setting' => 'woo_options[woo_nav_font][color]',
'label' => __( 'H2 Color', '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' => 'cm_fonts_navigation',
'default' => isset($woo_options['woo_nav_font']['color']) ? $woo_options['woo_nav_font']['color'] : '#0088cc',
'priority' => 10,
'output' => array(
array(
'element' => 'h2',
'property' => 'color',
'units' => ' !important'
),
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'h2',
'function' => 'css',
'property' => 'color',
),
)
);
$controls[] = array(
'type' => 'slider',
'options_type' => 'woo2d',
'setting' => 'woo_options[forTESTING][test01]',
'label' => __( 'UL class NAV LI A', 'example' ),
'section' => 'cm_fonts_navigation',
'default' => $woo_options['woo_nav_font']['size'] ? $woo_options['woo_nav_font']['size'] : '12',
'priority' => 24,
'choices' => array(
'min' => 10,
'max' => 36,
'step' => 1,
'units' => 'px', // If defined, this will be added to the value of control in SliderControl.php
),
'output' => array(
'element' => 'ul.nav li a',
'property' => 'font-size',
),
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => 'ul.nav li a',
'function' => 'css',
'property' => 'font-size',
),
/*array(
'element' => 'h1, h2, h3, h4',
'function' => 'css',
'property' => 'font-family',
),*/
)
);
// Define custom palettes
$controls[] = array(
'type' => 'palette',
'options_type'=> 'woo',
'setting' => 'palette_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' => 'cm_fonts_navigation',
'default' => 'red',
'priority' => 10,
'choices' => array(
'red' => array(
'#ef9a9a',
'#f44336',
'#ff1744',
),
'pink' => array(
'#fce4ec',
'#f06292',
'#e91e63',
'#ad1457',
'#f50057',
),
'cyan' => array(
'#e0f7fa',
'#80deea',
'#26c6da',
'#0097a7',
'#00e5ff',
),
),
);
return $controls;
}
add_filter( 'kirki/controls', 'customKirkiControls' );
/**
* Configuration sample for the Kirki Customizer
*/
function kirki_demo_configuration_sample() {
$args = array(
//'logo_image' => 'http://kirki.org/images/logo.png',
'description' => __( 'This is the theme description. You can edit it in the Kirki configuration and add whatever you want here.', 'kirki' ),
'color_accent' => '#00bcd4',
'color_back' => '#ffffff',
'url_path' => get_stylesheet_directory_uri() . '/includes/kirki/',
);
return $args;
}
add_filter( 'kirki/config', 'kirki_demo_configuration_sample' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment