Based on the WordPress Settings API, a class to generate options pages. Create settings forms with all basic input types, selects, textareas and media uploads.
// Define the page
$my_page = create_settings_page(
'my_page_id',
__( 'My Page' ),
array(
'title' => __( 'My Menu' )
),
array(
'my_setting_id' => array(
'title' => __( 'My Setting' ),
'description' => __( 'This is my section description.' ),
'fields' => array(
'my_option_name' => array(
'label' => __( 'My Option' ),
'description' => __( 'This is my field description.' )
)
)
)
)
);
// Access the values
$my_value = get_setting( 'my_setting_id', 'my_option_name' );
Settings are really useful to provide an easy configuration of themes and plugins to our users within their administration panel. But the creation of options pages often ends up in a messy and repetitive use of the great WordPress Settings API.
Considering generic form fields, this is a class to clean and simplify the process. It’s something light that shall be used on the admin side.
- Download the last release
- Unzip it into your theme or plugin
require_once( 'path/to/wm-settings/plugin.php' );
If you are interested by this project, please feel free to contribute in any way you like.
You can contact @WebmaestroFR on twitter.
WTFPL – Do What the Fuck You Want to Public License