Skip to content
devinsays edited this page Jul 16, 2012 · 5 revisions

The following is a list of all the options that can be used with the Options Framework. The 'id' fields should be lowercase with no spaces.

When options are saved, they are stored as single serialized array in the WordPress database.

heading

Creates a new tab on the theme options page

###Fields:

  • name = display string
  • type = heading

Example

    $options[] = array(
        'name' => __('Basic Settings', 'options_check'),
        'type' => 'heading');

info

Creates a section to output text or html

###Fields

  • name = display string
  • desc = string of text to show user
  • type = info

###Example

$options[] = array(
    'name' => __('Example Info', 'options_check'),
    'desc' => __('This is just some example information you can put in the panel.', 'options_check'),
    'type' => 'info');

text

Creates an input field

###Fields

  • name = display string
  • desc = description string
  • id = name of option as stored in the database
  • std = default value
  • class = (Optional) CSS class to add
  • type = text

###Example

$options[] = array(
    'name' => __('Input Text Mini', 'options_check'),
    'desc' => __('A mini text input field.', 'options_check'),
    'id' => 'example_text_mini',
    'std' => 'Default',
    'class' => 'mini',
    'type' => 'text');

textarea

Creates a textarea field

###Fields

  • name = display string
  • desc = description string
  • id = name of option as stored in the database
  • std = default value
  • class = (Optional) CSS class to add
  • type = textarea

###Example

$options[] = array(
    'name' => __('Textarea', 'options_check'),
    'desc' => __('Textarea description.', 'options_check'),
    'id' => 'example_textarea',
    'std' => 'Default Text',
    'type' => 'textarea');

select

Creates an dropdown select box

###Fields

  • name = display string
  • desc = description string
  • id = name of option as stored in the database
  • std = default value
  • class = (Optional) CSS class to add
  • type = select
  • options = array of options

###Example

$test_array = array(
    'one' => __('One', 'options_check'),
    'two' => __('Two', 'options_check'),
    'three' => __('Three', 'options_check'),
    'four' => __('Four', 'options_check'),
    'five' => __('Five', 'options_check')
);

$options[] = array(
    'name' => __('Input Select Small', 'options_check'),
    'desc' => __('Small Select Box.', 'options_check'),
    'id' => 'example_select',
    'std' => 'three',
    'type' => 'select',
    'class' => 'mini', //mini, tiny, small
    'options' => $test_array);

radio

Creates a set of radio buttons from an array ###Fields

  • name = display string
  • desc = description string
  • id = name of option as stored in the database
  • std = default value
  • class = (Optional) CSS class to add
  • type = radio
  • options = array of options

###Example

$test_array = array(
    'one' => __('One', 'options_check'),
    'two' => __('Two', 'options_check'),
    'three' => __('Three', 'options_check'),
    'four' => __('Four', 'options_check'),
    'five' => __('Five', 'options_check')
);

$options[] = array(
    'name' => __('Input Radio (one)', 'options_check'),
    'desc' => __('Radio select with default options "one".', 'options_check'),
    'id' => 'example_radio',
    'std' => 'one',
    'type' => 'radio',
    'options' => $test_array);

single checkbox

Create a single checkbox

###Fields

  • name = display string
  • desc = description string
  • id = name of option as stored in the database
  • std = default value
  • class = (Optional) CSS class to add
  • type = checkbox

###Example

$options[] = array(
    'name' => __('Input Checkbox', 'options_check'),
    'desc' => __('Example checkbox, defaults to true.', 'options_check'),
    'id' => 'example_checkbox',
    'std' => '1',
    'type' => 'checkbox');

multicheck

Creates a group of checkboxes, with the ability to select multiple items

###Fields

  • name = display string
  • desc = description string
  • id = name of option as stored in the database
  • std = array of checkboxes to select
  • class = (Optional) CSS class to add
  • type = multicheck
  • options = array of options

###Example

$multicheck_array = array(
    'one' => __('French Toast', 'options_check'),
    'two' => __('Pancake', 'options_check'),
    'three' => __('Omelette', 'options_check'),
    'four' => __('Crepe', 'options_check'),
    'five' => __('Waffle', 'options_check')
);

$multicheck_defaults = array(
    'one' => '1',
    'five' => '1'
);

$options[] = array(
    'name' => __('Multicheck', 'options_check'),
    'desc' => __('Multicheck description.', 'options_check'),
    'id' => 'example_multicheck',
    'std' => $multicheck_defaults, // These items get checked by default
    'type' => 'multicheck',
    'options' => $multicheck_array);

upload

Creates a file uploader

###Fields

  • name = display string
  • desc = description string
  • id = name of option as stored in the database
  • type = upload

###Example

$options[] = array(
'name' => __('Uploader Test', 'options_check'),
'desc' => __('This creates a full size uploader that previews the image.', 'options_check'),
'id' => 'example_uploader',
'type' => 'upload');

images

Creates an image selector. Images to select from are contained in an array an must already exist on the server

###Fields

  • name = display string
  • desc = description string
  • id = name of option as stored in the database
  • std = default value
  • class = (Optional) CSS class to add
  • type = checkbox
  • options = array of options

###Example

$options[] = array(
    'name' => "Example Image Selector",
    'desc' => "Images for layout.",
    'id' => "example_images",
    'std' => "2c-l-fixed",
    'type' => "images",
    'options' => array(
        '1col-fixed' => $imagepath . '1col.png',
        '2c-l-fixed' => $imagepath . '2cl.png',
        '2c-r-fixed' => $imagepath . '2cr.png')
);

## color
Creates a color picker

###Fields
* name = display string
* desc = description string
* id = name of option as stored in the database
* std = default value
* class = (Optional) CSS class to add
* type = color

###Example
```php
$options[] = array(
    'name' => __('Colorpicker', 'options_check'),
    'desc' => __('No color selected by default.', 'options_check'),
    'id' => 'example_colorpicker',
    'std' => '',
    'type' => 'color' );

typography

Creates a group of fields to easily allow users to set font size, face, style, and color.

You can optionally provide a set of custom fonts to use in an array

###Fields

  • name = display string
  • desc = description string
  • id = name of option as stored in the database
  • std = default value
  • class = (Optional) CSS class to add
  • type = typography
  • options = array of options

###Example

$typography_defaults = array(
    'size' => '15px',
    'face' => 'georgia',
    'style' => 'bold',
    'color' => '#bada55' );

$typography_options = array(
    'sizes' => array( '6','12','14','16','20' ),
    'faces' => array( 'Helvetica Neue' => 'Helvetica Neue','Arial' => 'Arial' ),
    'styles' => array( 'normal' => 'Normal','bold' => 'Bold' ),
    'color' => false
);

$options[] = array(
    'name' => __('Custom Typography', 'options_check'),
    'desc' => __('Custom typography options.', 'options_check'),
    'id' => "custom_typography",
    'std' => $typography_defaults,
    'type' => 'typography',
    'options' => $typography_options );

editor

Create the rich wp_editor. An array is provided by example, however more settings are available at http://codex.wordpress.org/Function_Reference/wp_editor

'media_buttons' are not supported as there is no post to attach items to 'textarea_name' is set by the 'id' you choose

###Fields

  • name = display string
  • desc = description string
  • id = name of option as stored in the database
  • type = editor

###Example

$wp_editor_settings = array(
    'wpautop' => true, // Default
    'textarea_rows' => 5,
    'tinymce' => array( 'plugins' => 'wordpress' )
);

$options[] = array(
    'name' => __('Default Text Editor', 'options_check'),
    'desc' => sprintf( __( 'You can also pass settings to the editor. Read more about wp_editor in <a href="%1$s" target="_blank">the WordPress codex</a>', 'options_check' ), 'http://codex.wordpress.org/Function_Reference/wp_editor' ),
    'id' => 'example_editor',
    'type' => 'editor',
    'settings' => $wp_editor_settings );