A modern, comprehensive, and developer-friendly settings framework for WordPress plugins and themes. Build beautiful settings pages with 30+ field types, advanced features, and zero configuration hassle.
Donate to support this project at Buy me a coffee Donate to support this project at GitHub
Text, Textarea, Number, Email, URL, Password, Select, Radio, Checkbox, Switch, Multi-Select Tags, Color Picker, Date/Time, File Upload, Image Upload, Code Editor, WYSIWYG, Range Slider, and more!
- β‘ Auto-save with draft recovery
- π Real-time search & filter
- β¨οΈ Keyboard shortcuts (Ctrl+S, Ctrl+Z, etc.)
- β©οΈ Undo/Redo functionality
- β Field validation
- π‘ Tooltips
- π― Conditional fields
- π¦ Import/Export settings
- πͺ Accordion panels
- π·οΈ Tag-based multi-select
- π± Mobile responsive
- Simple API
- Extensive documentation
- Flexible integration (plugin or theme)
- Customizable placement (top-level, Settings, Tools, or custom menu)
- Role-based access control
- Hooks and filters
- Custom field types support
- WordPress 6.0 or higher
- PHP 7.1 or higher
- Download the framework
- Copy the
options-frameworkfolder to your plugin or theme directory - Include the framework class in your code
if (!class_exists('Modern_Settings_Framework')) {
require_once 'path/to/options-framework/class-modern-settings-framework.php';
}composer require your-vendor/modern-settings-framework<?php
// 1. Include the framework
if (!class_exists('Modern_Settings_Framework')) {
require_once 'options-framework/class-modern-settings-framework.php';
}
// 2. Create instance
$framework = new Modern_Settings_Framework( 'my_plugin_settings' );
// 3. Register settings page
$framework->register_settings_page( array(
'type' => 'top_level',
'page_title' => 'My Plugin Settings',
'menu_title' => 'My Plugin',
'menu_slug' => 'my-plugin',
'icon_url' => 'dashicons-admin-settings',
) );
// 4. Register tabs
$framework->register_tab( 'general', array(
'title' => 'General Settings',
'icon' => 'dashicons-admin-generic',
) );
// 5. Register fields
$framework->register_field( 'general', array(
'id' => 'site_name',
'type' => 'text',
'label' => 'Site Name',
'description' => 'Enter your site name',
'default' => get_bloginfo( 'name' ),
) );
$framework->register_field( 'general', array(
'id' => 'enable_feature',
'type' => 'switch',
'label' => 'Enable Feature',
'description' => 'Turn feature on or off',
'default' => true,
) );
// 6. Get settings values
$settings = get_option( 'my_plugin_settings' );
$site_name = isset( $settings['site_name'] ) ? $settings['site_name'] : '';// Create framework with custom options
$framework_options = array(
'enable_search' => true,
'enable_autosave' => true,
'autosave_interval' => 30,
'enable_keyboard_shortcuts' => true,
'enable_undo_redo' => true,
'enable_validation' => true,
'capability' => 'manage_options',
'svg_logo' => '',
'image_logo' => '',
'title' => '',
'allowed_roles' => array( 'administrator', 'editor' ),
);
$framework = new Modern_Settings_Framework( 'my_settings', $framework_options );Comprehensive documentation is available in the /docs folder:
- Getting Started - Installation and basic setup
- Framework Options - Configuration options
- Registering Pages - Settings page placement
- Field Types - All 30+ field types with examples
- Field Parameters - Common field parameters
- Conditional Fields - Show/hide fields based on conditions
- Validation - Field validation rules
- Custom Buttons - Adding custom action buttons
- Hooks & Filters - Extending functionality
- Examples - Real-world usage examples
text- Single-line text inputtextarea- Multi-line text inputnumber- Numeric input with min/maxemail- Email validationurl- URL validationpassword- Password field with show/hide togglehidden- Hidden input
select- Dropdown selectradio- Radio buttonscheckbox- Single checkboxcheckbox_group- Multiple checkboxesmulti_select_tags- Tag-based multi-select with searchswitch- Toggle switch
color- Color pickerfile- File uploadimage- Image upload with previewgallery- Multiple image upload
code- Code editor with syntax highlightingwysiwyg- WordPress WYSIWYG editordate- Date pickertime- Time pickerdatetime- Date and time pickerrange- Range slider
divider- Visual separator with optional titleinfo- Information/alert box (success, warning, error, info)accordion- Collapsible panel groupingaccordion_end- Close accordion
View detailed field documentation β
// Show API key field only when feature is enabled
$framework->register_field( 'general', array(
'id' => 'enable_api',
'type' => 'switch',
'label' => 'Enable API',
'default' => false,
) );
$framework->register_field( 'general', array(
'id' => 'api_key',
'type' => 'text',
'label' => 'API Key',
'conditional' => array(
'field' => 'enable_api',
'value' => true,
),
) );$framework->register_field( 'general', array(
'id' => 'email',
'type' => 'email',
'label' => 'Contact Email',
'required' => true,
'validation' => array(
'min_length' => 5,
'max_length' => 100,
),
) );// Start accordion
$framework->register_field( 'advanced', array(
'type' => 'accordion',
'id' => 'email_settings',
'title' => 'Email Configuration',
'icon' => 'dashicons-email',
'collapsed' => false,
) );
// Fields inside accordion
$framework->register_field( 'advanced', array(
'id' => 'smtp_host',
'type' => 'text',
'label' => 'SMTP Host',
) );
$framework->register_field( 'advanced', array(
'id' => 'smtp_port',
'type' => 'number',
'label' => 'SMTP Port',
) );
// End accordion
$framework->register_field( 'advanced', array(
'type' => 'accordion_end',
) );// Register export button
$framework->register_custom_button( 'general', array(
'id' => 'export_settings',
'label' => 'Export Settings',
'class' => 'button-secondary',
'callback' => 'my_export_callback',
) );
// Callback function
function my_export_callback( $framework ) {
$settings = $framework->get_saved_settings();
return array(
'message' => 'Settings exported!',
'download' => true,
'filename' => 'settings.json',
'content' => wp_json_encode( $settings ),
);
}$framework->register_field( 'general', array(
'id' => 'user_roles',
'type' => 'multi_select_tags',
'label' => 'Allowed Roles',
'max_selections' => 3,
'options' => array(
'administrator' => 'Administrator',
'editor' => 'Editor',
'author' => 'Author',
),
) );// Top-level menu
$framework->register_settings_page( array(
'type' => 'top_level',
'page_title' => 'My Settings',
'menu_title' => 'My Plugin',
'menu_slug' => 'my-plugin',
) );
// Under Settings menu
$framework->register_settings_page( array(
'type' => 'submenu_settings',
'page_title' => 'My Settings',
'menu_title' => 'My Plugin',
) );
// Under Tools menu
$framework->register_settings_page( array(
'type' => 'submenu_tools',
'page_title' => 'My Tools',
'menu_title' => 'My Plugin',
) );
// Under custom parent (e.g., WooCommerce)
$framework->register_settings_page( array(
'type' => 'submenu_custom',
'parent_slug' => 'woocommerce',
'page_title' => 'My Settings',
'menu_title' => 'My Integration',
) );// Create instance
new Modern_Settings_Framework( string $option_name, array $framework_options = array() )
// Register settings page
$framework->register_settings_page( array $config )
// Register tab
$framework->register_tab( string $tab_id, array $config )
// Register field
$framework->register_field( string $tab_id, array $config )
// Register custom button
$framework->register_custom_button( string $tab_id, array $config )
// Get saved settings
$framework->get_saved_settings()
// Get specific setting
$framework->get_setting( string $key, mixed $default = null )
// Update specific setting
$framework->update_setting( string $key, mixed $value )View full API documentation β
modern-settings-framework/
βββ options-framework/
β βββ class-modern-settings-framework.php # Main framework class
β βββ includes/
β β βββ admin-page.php # Settings page template
β β βββ field-renderer.php # Field rendering functions
β βββ assets/
β βββ css/
β β βββ admin-styles.css # Main styles
β β βββ fields.css # Field-specific styles
β βββ js/
β βββ admin-scripts.js # Core functionality
β βββ fields.js # Field-specific JS
βββ modern-settings-framework-demo.php # Demo plugin
βββ README.md # This file
βββ docs/ # Documentation folder
βββ 01-getting-started.md
βββ 02-framework-options.md
βββ 03-registering-pages.md
βββ ...
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Read contributing guidelines β
Additional Assets Support
- Added
additional_stylesandadditional_scriptsframework options to enqueue custom CSS and JavaScript files - New action hooks for manual asset adjustments after enqueuing
- View Documentation
Custom Button Enhancements
- Added
locationparameter to position buttons at top or bottom of settings page - Added
reloadparameter to automatically reload page after button action - View Documentation
Text Domain Customization
- Added
text_domainframework option for embedding in plugins and themes - Framework now respects custom text domains for proper internationalization
- Added
get_text_domain()method and public$text_domainproperty - View Documentation
See full changelog: CHANGELOG.md
This project is licensed under the GPL-2.0+ License - see the LICENSE file for details.
Modern Settings Framework is created and maintained by AppsCreo.
- WordPress
- jQuery
- CodeMirror
- WordPress Color Picker
- Documentation: docs/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
If you find this project useful, please consider giving it a star on GitHub!
Made with β€οΈ for the WordPress community
