What is it?
This helper class lets you create the settings page for your plugin using the Wordpress Settings API without having to deal with the API directly.
No deeper dependencies, No framework, just a light weight helper class!
require the class, hook into
admin_menu and pass the config array to class object to build your plugin settings page.
Why should i use it?
If you want to create plugin settings menu that is following WordPress best practices without having to deal with complex WorPress Settings API, then this helper class can be used.
- Take away the pain of dealing with Settings API
- One config array to create everything: admin menu, settings page, sections, fields.
- Fields input is auto sanitized
- Can be used to make Tabs or Tab-less Settings page
- Can be used to add plugin action links
- Ability to override sanitization callback
- Ability to override fields display callback
How to use?
Complete Details can be found in the Wiki, in the nutshell, follow the steps:
- copy the class in plugin assets folder and require the class in your plugin files (add dependency)
- hook into
admin_menuand provide a callback function
- in the callback function, pass the config array to this helper class object to build your sections and fields.
Its that easy. Here is a simple example code that will create a plugin menu, 2 sections and some fields under these sections.
Here are two example plugins to demonstrate this class if you can figure out thing at your own:
- Functional / Procedural plugin example
- Object Oriented Plugin Example
What this helper class can create?
This helper class can create the following:
- Plugin admin menu (top level / sub menu)
- Settings Sections (tabbed and tab-less)
- Settings fields under these sections
Available Field Types
Following Field Types can be added using this Helper Class:
- posts (WP posts and Custom Post Types)
- pages (WP pages)