The Platonic Framework is an OOP (Object-oriented Programming) solution to create your own settings pages through the WordPress Settings API and the Customizer API.
Basic examples are provided to guide you through the use of this API and the creation of your first settings page.
You have two different methods to start using the Platonic Framework. You can choose if you want to install the WordPress plugin (recommended) or to include it as part of the plugin/theme you are developing.
This is the easiest method, and it will allow you to receive updates as well as not having to include the files multiple times if you have multiple plugins and/or themes using the Platonic Framework.
- Download this library and include it in your project.
- (Manual installation only) Require the
platonic-framework.php
file
- Create your PHP class
- Extend your class with the
Platonic\Framework\ThemeSettings
or thePlatonic\Framework\PluginSettings
The Platonic Framework includes some wrapper functions around WordPress functions used to create your custom settings pages.
add_options_page( $page_title, $menu_title, $capability = 'manage_options', $position = null )
add_menu_page( $page_title, $menu_title, $icon_url = '', $capability = 'manage_options', $position = null )
add_submenu_page( $parent_slug, $page_title, $menu_title, $capability = 'manage_options', $position = null )
To contribute to this library, please send a pull request.
- Compatible with array options.
- Compatible with individual options.
- Register multiple individual settings in a single class.
- Allow registering settings as options or theme_mods.
- REST API compatibility. Requires schema definition for each field.