Download the PHP package ralfhortt/wp-settings without Composer
On this page you can find all versions of the php package ralfhortt/wp-settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ralfhortt/wp-settings
More information about ralfhortt/wp-settings
Files in ralfhortt/wp-settings
Package wp-settings
Short Description A helper package for working with the WordPress Settings
License MIT
Informations about the package wp-settings
WordPress Settings API Composer Package
A helper package for working with the WordPress Settings API
Installation
composer require ralfhortt/wp-settings
Usage
Settings Page
The Settings Page approach uses the WordPress Settings API to create admin settings pages and subpages.
Basic Usage
Pages default to the Settings menu. Use a location method to place the page elsewhere (see Page Location).
Settings Page Configuration
Page Location
Choose where the settings page appears in the WordPress admin menu:
| Method | Admin menu |
|---|---|
optionsPage() |
Settings (default) |
themesPage() |
Appearance |
toolsPage() |
Tools |
pluginsPage() |
Plugins |
usersPage() |
Users |
topLevel($icon, $position) |
Top-level sidebar item |
subpageUnder($slug) |
Custom parent (escape hatch) |
Multiple Panel Tabs On One Page
When you register more than one panel on the same page, the page renders panel tabs automatically.
Notes:
- Panels become tabs only when at least two panels exist.
- A panel can contain multiple sections.
- Section order follows the order you define in your fluent chain.
Top-Level Menu Page
Advanced Usage
Settings Page Advanced Features
Options Storage
Check for a capability
Add a description
Hidden field
Stores a value that is not editable in the UI. Pass a fixed value, or a Closure for a dynamic value. The resolved value is forced on both render and save (submitted input is ignored).
Retrieving data
Changelog
v1.1.0
- Add
hidden()field type (fixed value or callback)
v1.0.0
- Initial release
- Add
wysiwyg()field type - Add named page location methods:
optionsPage(),themesPage(),toolsPage(),pluginsPage(),usersPage() - Add panel tab support