Download the PHP package sofyansitorus/wp-yes without Composer
On this page you can find all versions of the php package sofyansitorus/wp-yes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sofyansitorus/wp-yes
More information about sofyansitorus/wp-yes
Files in sofyansitorus/wp-yes
Package wp-yes
Short Description WordPress Yet Easy Settings class is PHP class for easy to build advanced admin page for WordPress.
License GPL-2.0-or-later
Homepage https://github.com/sofyansitorus/WordPress-Yet-Easy-Settings
Informations about the package wp-yes
WordPress-Yet-Easy-Settings
WordPress Yet Easy Settings class is PHP class for easy to build advanced admin page for WordPress.
Built-in setting field types
- Text
- URL
- Password
- Number
- Decimal
- Textarea
- Checkbox
- Multiple Checkbox
- Select
- Multiple Select
- Radio Button
- Color Picker
- File Upload
- WYSIWYG
Key features
- Add as many as admin pages, placed it any where as top level admin menu or sub-menu.
- Add custom callback to render custom setting field type.
- Add custom callback to render custom tab content.
- Add custom callback to render custom page content.
- Built-in data sanitation and validation.
- Easy to add help tabs for admin page.
- Easy to add custom action button for admin page.
- Enqueue custom scripts and styles.
- Built-in data validation.
How to Use
Installation:
composer require sofyansitorus/wp-yes
After you include the WP_Yes class file, all you have to do is to initialize the WP_Yes class, then add the settings object properties in sequence add tabs, add sections, add fields.
Simple admin page setting
This is the simplest way to initialize the setting page without defining the tabs and sections.
We can also add the setting fields in bulk by using the WP_Yes::add_fields
method.
Simple admin page setting with Section
This is the simplest way to initialize the setting page without defining the tabs and sections.
Multiple tabs admin page setting
By default, the setting page will only has 1 tab. If you want to add more tabs, just simply call the WP_Yes::add_tab method after the last WP_Yes::add_field for each tabs, and then following in sequence calling WP_Yes::add_section and WP_Yes::add_field method.
A note you must keep in hand here is that you need to have a unique value for the menu_slug parameter that passed in the WP_Yes class constructor and field id key in the WP_Yes::add_field method parameter. You can have same tab id in different page menu, also can has same sections id in different tabs.
Admin page setting with custom action button and help tabs
To add help tabs and custom actin button to the admin page, you need to call WP_Yes::add_help_tab and WP_Yes::add_button method anywhere before calling the WP_Yes::init method.
Getting the stored option value
To get the option value is by call built-in WordPress get_option function with filed id as the first argument.
If you set the $setting_prefix value at third arguments in WP_Yes constructor, or set the prefix with WP_Yes::set_prefix
method, then you need to pre-pend that prefix when calling *get_option** function.
For more advanced example such as adding custom tab content, adding custom page content, etc, please take a look all the samples available in example folder.
Screenshots
Simple Setting Form
All Fields Types