-
Notifications
You must be signed in to change notification settings - Fork 43
Editing options
scribu edited this page Apr 12, 2012
·
4 revisions
With editable_option()
, you can make arbitrary parts of your theme editable:
<?php editable_option( array(
'key' => 'favorite_color',
'type' => 'textarea',
'default' => 'green'
) ); ?>
'key' is the name of the option
'type' is the type of interface you want to be editing it with. Other possible values for type: 'input', 'checkbox', 'select', 'textarea' or 'rich'.
'default' is the default value of the option.
Here's another example, where the user is forced to select from a predefined set of colors:
<?php editable_option( array(
'key' => 'favorite_color',
'type' => 'select',
'values' => array( 'red', 'white', 'blue', 'green', 'yellow' )
'default' => 'green'
) ); ?>