Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Editing options

scribu edited this page · 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'
) ); ?>
Something went wrong with that request. Please try again.