-
Notifications
You must be signed in to change notification settings - Fork 16
Adding Options Pages
Michiel Tramper edited this page Mar 28, 2018
·
11 revisions
Option Pages can be added by using the add method, where $values are an array of settings.
$fields = MakeitWorkPress\WP_Custom_Fields\Framework::instance();
$fields->add( 'options', $values );A complete example can be found under examples.
On the highest level, an options field may have the following keys.
| key | type | description |
|---|---|---|
| title | string | The title of the options page (required) |
| menu_title | string | The title used in the menu (required) |
| capability | string | The capability, such as 'manage_options' (required). |
| id | string | The id of the options page (required). This is the name under which the option will be saved, as well as the slug of your options page. |
| location | string | The optional location of the options page within the dashboard menu. Defaults to 'menu'. Supports 'menu', 'submenu', 'dashboard', 'posts', 'media', 'links', 'pages', 'comments', 'theme', 'users', 'management' or 'options'. |
| menu_position | int | The position in the WordPress admin menu. A higher value is lower down in the menu. Required if the location is set to 'menu'. |
| menu_icon | string | The dashicon icon for the menu, such as ''dashicons-admin-generic''. Required if the location is set to 'menu'. |
| slug | string | The parent slug under which a sub menu page is added. Required if the location is set to 'submenu'. |
| class | string | An optional class for this page. Also supports 'tabs-left' to display tabs to the left. |
| sections | array | The sections, which each have a group of fields |
WP Custom Fields has been developed by Make it WorkPress