<?php if (!defined('ABSPATH')) {die;} // Cannot access directly.
//
// Set a unique slug-like ID
//
$prefix = '_prefix_my_options';
//
// Create options
//
CSF::createOptions($prefix, array(
'menu_title' => 'CSF Demo',
'menu_slug' => 'csf-demo',
'theme' => 'light',
));
//
// Create a section
//
CSF::createSection($prefix, array(
'title' => 'Overview',
'icon' => 'fas fa-rocket',
'fields' => array(
//
// A text field
//
array(
'id' => 'opt-text',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'opt-textarea',
'type' => 'textarea',
'title' => 'Textarea',
'help' => 'The help text of the field.',
),
array(
'id' => 'opt-upload',
'type' => 'upload',
'title' => 'Upload',
),
array(
'id' => 'opt-switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label text of the switcher.',
),
array(
'id' => 'opt-color',
'type' => 'color',
'title' => 'Color',
'default' => '#3498db',
),
array(
'id' => 'opt-checkbox',
'type' => 'checkbox',
'title' => 'Checkbox',
'label' => 'The label text of the checkbox.',
),
array(
'id' => 'opt-radio',
'type' => 'radio',
'title' => 'Radio',
'options' => array(
'yes' => 'Yes, Please.',
'no' => 'No, Thank you.',
),
'default' => 'yes',
),
array(
'id' => 'opt-select',
'type' => 'select',
'title' => 'Select',
'placeholder' => 'Select an option',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
array(
'id' => 'opt-image-select',
'type' => 'image_select',
'title' => 'Image Select',
'options' => array(
'opt-1' => 'http://codestarframework.com/assets/images/placeholder/100x80-2ecc71.gif',
'opt-2' => 'http://codestarframework.com/assets/images/placeholder/100x80-e74c3c.gif',
'opt-3' => 'http://codestarframework.com/assets/images/placeholder/100x80-ffbc00.gif',
'opt-4' => 'http://codestarframework.com/assets/images/placeholder/100x80-3498db.gif',
'opt-5' => 'http://codestarframework.com/assets/images/placeholder/100x80-555555.gif',
),
'default' => 'opt-1',
),
array(
'id' => 'opt-background',
'type' => 'background',
'title' => 'Background',
),
array(
'type' => 'notice',
'style' => 'success',
'content' => 'A <strong>notice</strong> field with <strong>success</strong> style.',
),
array(
'id' => 'opt-icon',
'type' => 'icon',
'title' => 'Icon',
),
array(
'id' => 'opt-alt-text',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'opt-alt-textarea',
'type' => 'textarea',
'title' => 'Textarea',
'subtitle' => 'A textarea with shortcoder.',
'shortcoder' => 'csf_demo_shortcodes',
),
),
));
//
// Basic Fields
//
CSF::createSection($prefix, array(
'id' => 'basic_fields',
'title' => 'Basic Fields',
'icon' => 'fas fa-plus-circle',
));
//
// Field: text
//
CSF::createSection($prefix, array(
'parent' => 'basic_fields',
'title' => 'Text',
'icon' => 'far fa-square',
'description' => 'Visit documentation for more details on this field: <a href="http://codestarframework.com/documentation/#/fields?id=text" target="_blank">Field: text</a>',
'fields' => array(
array(
'id' => 'opt-text-1',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'opt-text-2',
'type' => 'text',
'title' => 'Text with default',
'default' => 'This is default value bla bla bla',
),
array(
'id' => 'opt-text-3',
'type' => 'text',
'title' => 'Text field ingenuity',
'subtitle' => 'The field of subtitle text.',
'help' => 'The field of help text.',
'before' => '<p>The field of before text.</p>',
'after' => '<p>The field of after text.</p>',
),
array(
'id' => 'opt-text-4',
'type' => 'text',
'title' => 'Text with placeholder',
'placeholder' => 'Typed something...',
),
array(
'id' => 'opt-text-5',
'type' => 'text',
'title' => 'Text readonly',
'attributes' => array(
'readonly' => 'readonly',
),
'default' => 'readonly text field, can not be changed',
),
array(
'id' => 'opt-text-6',
'type' => 'text',
'title' => 'Text with maxlength (5)',
'attributes' => array(
'maxlength' => '5',
),
'default' => 'abc',
),
array(
'id' => 'opt-text-7',
'type' => 'text',
'title' => 'Text usign custom styles',
'attributes' => array(
'style' => 'width: 100%; height: 40px; border-color: #93C054;',
),
),
array(
'id' => 'opt-text-8',
'type' => 'text',
'after' => '<p>It shows full width if there is no field of title.</p>',
),
),
));
//
// Field: textarea
//
CSF::createSection($prefix, array(
'parent' => 'basic_fields',
'title' => 'Textarea',
'icon' => 'far fa-square',
'description' => 'Visit documentation for more details on this field: <a href="http://codestarframework.com/documentation/#/fields?id=textarea" target="_blank">Field: textrea</a>',
'fields' => array(
array(
'id' => 'opt-textarea-1',
'type' => 'textarea',
'title' => 'Textarea',
),
array(
'id' => 'opt-textarea-2',
'type' => 'textarea',
'title' => 'Textarea wtih default',
'default' => 'This is default value bla bla bla',
),
array(
'id' => 'opt-textarea-3',
'type' => 'textarea',
'title' => 'Text with placeholder',
'placeholder' => 'Typed something...',
),
array(
'id' => 'opt-textarea-4',
'type' => 'textarea',
'title' => 'Textarea with shortcoder',
'shortcoder' => 'csf_demo_shortcodes',
),
array(
'id' => 'opt-textarea-5',
'type' => 'textarea',
'title' => 'Textarea field ingenuity',
'subtitle' => 'The field of subtitle text.',
'help' => 'The field of help text.',
'before' => '<p>The field of before text.</p>',
'after' => '<p>The field of after text.</p>',
),
array(
'id' => 'opt-textarea-6',
'type' => 'textarea',
'after' => '<p>It shows full