An easy-pease API to build custom admin pages
The existing Settings API in WP requires us to write lots of callbacks even for the simplest stuff. The reason behind this plugin is to simplify the way admin pages are being created. The plugins abstracts away all the quirks of Settings API and provides an easy to use API for building admin pages.
You can install this plugin in two ways:
-
Install the plugin from Wordpress Plugins
-
To install the plugin using Composer and wpackagist, add the following line to composer.json:
"wpackagist-plugin/peasy-admin": "^1.2.0"
As the Settings API, Peasy Admin consists of the following elements: AdminPage, Section, and Field. First, let's create an admin page. It is recommended to use peasy_init action to ensure that the page will be generated without worrying about the order of plugins:
add_action( 'peasy_init', function() {
$admin_page = new PeasyAdmin\AdminPage( 'My Admin Page', 'my-admin-page' );
$admin_page->setup();
} );
AdminPage class requires title and slug parameters to create the admin page. setup method is needed to transform Peasy API into settings API. Therefore, all the sections and fields must be defined before setup.
Check out the Wiki for usage, examples, and API reference.
This project adheres to the Open Code of Conduct. By participating, you are expected to honor this code.
If you have encountered a bug, please use Github Issues to submit a an issue.
Before submitting pull request please conform to Wordpress PHP Coding Standards. Naming class names and file names are an exception to these guidelines until we can find a better solution.
- Fork this repository
- Create a new branch from master
- Commit your changes
- Push to the newly created branch
- Submit a pull request
- Sit back, relax, and wait for a response 😃
This project is licensed under GPLv3. Please read the LICENSE file for details.