Skip to content

Instantly share code, notes, and snippets.

@munirkamal
Created December 5, 2017 08:59
Show Gist options
  • Save munirkamal/17deb0a67eba34fc8ae3b5390b800e0a to your computer and use it in GitHub Desktop.
Save munirkamal/17deb0a67eba34fc8ae3b5390b800e0a to your computer and use it in GitHub Desktop.
<?php
Kirki::add_panel( 'test_panel', array(
'priority' => 10,
'title' => __( 'My Panel', 'start' ),
) );
Kirki::add_section( 'test_section', array(
'title' => __( 'My Section', 'start' ),
'panel' => 'test_panel',
) );
Kirki::add_field( 'start', array(
'type' => 'radio-buttonset',
'settings' => 'test_radio',
'label' => __( 'Radio', 'start' ),
'section' => 'test_section',
'default' => 'layout',
'transport' => 'postMessage',
'choices' => array(
'layout' => esc_attr__( 'Layout', 'start' ),
'design' => esc_attr__( 'Design', 'start' ),
'advanced' => esc_attr__( 'Advanced', 'start' ),
),
) );
Kirki::add_field( 'start', array(
'type' => 'textarea',
'settings' => 'test_content',
'label' => __( 'Content', 'start' ),
'section' => 'test_section',
'default' => esc_attr__( 'This is a Test', 'start' ),
'active_callback' => array(
array(
'setting' => 'test_radio',
'operator' => '==',
'value' => 'layout',
),
),
) );
Kirki::add_field( 'start', array(
'type' => 'typography',
'settings' => 'test_typo',
'label' => esc_attr__( 'Content Typography', 'start' ),
'section' => 'test_section',
'default' => array(
'font-size' => '14px',
'color' => '#333333',
'text-align' => 'left'
),
'output' => array(
array(
'element' => '.test h4',
),
),
'active_callback' => array(
array(
'setting' => 'test_radio',
'operator' => '==',
'value' => 'design',
),
),
) );
Kirki::add_field( 'start', array(
'settings' => 'test_spacing',
'section' => 'test_section',
'label' => esc_html__( 'Padding', 'start' ),
'type' => 'spacing',
'default' => array(
'top' => '20px',
'right' => '15px',
'bottom' => '20px',
'left' => '15px',
),
'output' => array(
array(
'element' => '.test',
'property' => 'padding',
),
),
'active_callback' => array(
array(
'setting' => 'test_radio',
'operator' => '==',
'value' => 'advanced',
),
),
) );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment