Skip to content

Instantly share code, notes, and snippets.

<?php
'my_setting' => array(
'type' => 'button-group',
'label' => 'My Setting',
'default' => 'two',
'options' => array(
'one' => 'One',
'two' => 'Two',
'three' => 'Three',
),
<?php
'text-align' => array(
'type' => 'align',
'label' => 'Text Align',
'values' => array(
'left' => '0 auto 0 0',
'center' => '0 auto',
'right' => '0 0 0 auto',
),
),
<?php
'text-align' => array(
'type' => 'align',
'label' => 'Text Align',
'default' => 'center',
'preview' => array(
'type' => 'css',
'selector' => '.my-selector',
'property' => 'text-align',
),
<?php
'icon' => array(
'type' => 'icon',
'label' => 'My Icon',
'show' => array(
'fields' => array( 'field_1', 'field_2' ),
'sections' => array( 'section_1', 'section_2' ),
'tabs' => array( 'tab_1', 'tab_2' ),
),
),
<?php
'width' => array(
'type' => 'unit',
'label' => 'Width',
'units' => array( 'px', 'vw', '%' ),
'slider' => array(
'px' => array(
'min' => 0,
'max' => 1000,
'step' => 10,
<?php
'width' => array(
'type' => 'unit',
'label' => 'Width',
'slider' => array(
'min' => 0,
'max' => 1000,
'step' => 10,
),
),
<?php
'width' => array(
'type' => 'unit',
'label' => 'Width',
'slider' => true,
),
<?php
$value = $settings->width . $settings->width_unit
<?php
'width' => array(
'type' => 'unit',
'label' => 'Width',
'units' => array( 'px', 'vw', '%' ),
'default_unit' => '%', // Optional
'preview' => array(
'type' => 'css',
'selector' => '.my-class',
'property' => 'width',