Skip to content

Instantly share code, notes, and snippets.

@kovshenin
kovshenin / options.php
Created April 23, 2012 12:12
Reusable Settings API fields
<?php
/**
* Text Field
*
* A simple text field callback to use with the Settings API. Don't forget to pass in
* the arguments array. Here's an example call to add_settings_field() :
*
* add_settings_field( 'my_option', __( 'My Option' ), 'foo_field_text', 'theme_options', 'general', array(
* 'name' => 'my_theme_options[my_option]',
* 'value' => $options['my_option'], // assuming $options is declared