Options API:Creating Options

From StartBox Documentation

Jump to: navigation, search

This page outlines all the different option types you can create, along with some of the parameters each commonly accepts. If you're looking to add a single option to an existing metabox, have a look at sb_register_option()

Creating Options

To add options to your settings panel, you'll need to create an array.

$options = array(
	'option_name' => array(  // Unique name for your option
		'type' => '',	 // type of option (see list below)
		'label' => '',	 // label for the option
		'options' => '', // array, for select and radio options only
		'default' => '', // the default value
		'desc' => '',	 // a short description
		'size' => '',	 // for textboxes and select options only (small/medium/large)
		'align' => ''	 // specify left/right alignment (default: right)
	)
);

Option Types

*A Note About Select Options: Instead of defining the select-type options as an array, you can specify either 'categories' or 'pages' to automatically produce a comprehensive list of either item. (e.g. 'options' => 'categories')

Related

Options API: Adding Option Panels, Removing Option Panels, Creating Options, Interacting With Your Options

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox