{"id":31782122,"url":"https://github.com/polyplugins/settings-class-for-wordpress","last_synced_at":"2025-10-10T09:15:14.971Z","repository":{"id":201165966,"uuid":"385786468","full_name":"PolyPlugins/Settings-Class-for-Wordpress","owner":"PolyPlugins","description":"Building a WordPress admin settings page that's easy to extend and looks great (Bootstrap) has never been easier. Our settings class for WordPress makes use of Bootstrap, Bootstrap Icons, dynamic navigations, and preloading to give developers the easiest method of implementation.","archived":false,"fork":false,"pushed_at":"2025-08-23T13:27:08.000Z","size":1055,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-24T04:35:06.482Z","etag":null,"topics":["admin","bootstrap4","class","custom-wordpress","fontawesome5","settings","wordpress","wordpress-admin-panel","wordpress-development","wordpress-plugin","wordpress-theme"],"latest_commit_sha":null,"homepage":"https://www.polyplugins.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PolyPlugins.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-07-14T02:05:41.000Z","updated_at":"2025-08-23T13:27:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"42aafded-38a6-41f5-ad2c-fbf67c1cd05d","html_url":"https://github.com/PolyPlugins/Settings-Class-for-Wordpress","commit_stats":null,"previous_names":["polyplugins/settings-class-for-wordpress"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/PolyPlugins/Settings-Class-for-Wordpress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolyPlugins%2FSettings-Class-for-Wordpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolyPlugins%2FSettings-Class-for-Wordpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolyPlugins%2FSettings-Class-for-Wordpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolyPlugins%2FSettings-Class-for-Wordpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PolyPlugins","download_url":"https://codeload.github.com/PolyPlugins/Settings-Class-for-Wordpress/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolyPlugins%2FSettings-Class-for-Wordpress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003395,"owners_count":26083581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["admin","bootstrap4","class","custom-wordpress","fontawesome5","settings","wordpress","wordpress-admin-panel","wordpress-development","wordpress-plugin","wordpress-theme"],"created_at":"2025-10-10T09:15:13.738Z","updated_at":"2025-10-10T09:15:14.963Z","avatar_url":"https://github.com/PolyPlugins.png","language":"PHP","readme":"# Settings Class for WordPress\n\n![Demo](https://github.com/user-attachments/assets/f2c2ea9f-da11-43b7-9bd6-cfa8fe3457c0)\n\nOur goal was to create a class that could easily be imported into projects to give easy methods to handle adding a clean and dynamic settings panel to the backend of WordPress.\n\n## Update\nThis project will be actively maintained again as a Composer package.\n\nAs a composer package it will make it simpler for plugin developers to include the settings class directly, without extra plugins. Any breaking changes are reserved for major releases, so updates won’t catch you off guard.\n\nYou can still use [Reusable Admin Panel](https://wordpress.org/plugins/reusable-admin-panel/) if you like, but feature development has stopped and only critical fixes will be provided. If Reusable Admin Panel introduced breaking changes, it would impact any site using it unless we maintained full backwards compatibility, which adds unnecessary complexity. We also wanted to avoid forcing users to install extra plugins just to run ours, which is why this Composer based approach was a better fit for us.\n\n## Features\n\n- **Developer Friendly**\n  - All settings saved in a single multi-dimensional array for easier access\n  - Built-in sanitization and escaping for safer data handling\n  - Validation powered by [validator.js](https://github.com/validatorjs/validator.js)\n  - Clear placeholders, descriptions, and help text support on fields\n  - Separators for cleaner layouts\n  - Extendable and namespaced for easy integration into your own plugins\n\n- **Built-in Field Types**\n  - Text, textarea (single and multi-row), password, email, URL\n  - Number (with min/max/step), time, date, color picker\n  - Switch toggles\n  - Dropdowns (including disabled options)\n  - Dropdown toggle fields (switches between grouped sets of fields)\n  - Buttons with multiple actions (JS or external links)\n\n- **Section \u0026 Navigation Controls**\n  - Dynamic tab navigation with jQuery\n  - Subsections within sections (with icons and labels)\n  - Section \"notes\" with contextual alerts (success, warning, error)\n  \n- **Modern UI with Bootstrap**\n  - Clean Bootstrap container layout\n  - Built-in Bootstrap Icons for field helpers and navigation\n  - Sidebar info helper\n\n- **Flexible Configuration**\n  - Add plugin action links and meta links directly from config\n  - Permanent sidebar with configurable heading, text, and button\n  - Custom CSS/JS overrides\n\n- **Templating**\n  - Choose from Default and Recharge templates\n\n## Installation\nThe easiest way to install Settings Class for WordPress is via our [Boilerplate Generator](https://www.polyplugins.com/settings-class-for-wordpress-boilerplate-generator/). Once generated you can follow the below steps:\n\n1. Make sure you have [composer](http://getcomposer.org) installed\n2. Backup WordPress\n3. Copy the folder within the generated zip to your ```/wp-content/plugins/``` directory.\n4. Inside your generated plugin folder ```/wp-content/plugins/your-plugin/``` run ```composer install```\n5. Activate the plugin\n6. Visit Settings -\u003e Your Plugin in the backend of WordPress.\n\nYou can learn more about the fields and configuration parameters via our [Documentation](https://www.polyplugins.com/docs/settings-class-for-wordpress/).\n\n## Updates\nTo update minor or patch versions, run the following after taking a backup of WordPress:\n\n```composer update```\n\nWithin your plugin folder (```/wp-content/plugins/your-plugin/```)\n\nComposer will only update versions that fit the constraints defined in your composer.json, so major releases generally won't be installed automatically.\n\nMajor versions may include breaking changes, so review the release notes before updating and follow any migration instructions.\n\n## Example Plugin\n\nIf you want barebones you can create a test-plugin.php file within a new /wp-content/plugins/test-plugin/ folder and add the below code:\n```\n\u003c?php\n\n/**\n * Plugin Name: Test Plugin\n * Description: Test\n * Version: 1.0.0\n * Author: Poly Plugins\n * Author URI: https://www.polyplugins.com\n * Plugin URI: https://www.polyplugins.com\n */\n\nnamespace PolyPlugins\\Test_Plugin;\n\nrequire plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';\n\nuse PolyPlugins\\Settings\\Settings;\n\nif (!defined('ABSPATH')) exit;\n\nclass Test_Plugin\n{\n  \n  private $plugin;\n  private $namespace;\n  private $plugin_slug;\n  private $config;\n  private $fields;\n  private $settings;\n  \n  public function __construct()\n  {\n    $this-\u003eplugin      = __FILE__;\n    $this-\u003enamespace   = __NAMESPACE__;\n    $this-\u003eplugin_slug = dirname(plugin_basename($this-\u003eplugin));\n    \n    $this-\u003econfig = array(\n      'name'             =\u003e __('Test Plugin', 'test-plugin'), // The plugin name. Comment out to have it build the name from plugin slug\n      'menu_name'        =\u003e __('Test Plugin', 'test-plugin'), // The name you want to show in the admin menu. Comment out to have it build the name from plugin slug\n      'settings_name'    =\u003e 'test_plugin_settings_polyplugins, // To prevent conflicts you should include your company name as the suffix. This is the setting name you want to use for get_option. \n      'page'             =\u003e 'options-general.php', // You can use non php pages such as woocommerce here to display a submenu under WooCommerce\n      'position'         =\u003e 1, // Lower number moves the link position up in the submenu\n      'capability'       =\u003e 'manage_options', // What permission is required to see and edit settings\n      'css'              =\u003e '/css/style.css', // Your custom colors and styles. Comment out to use only the default style.\n      'js'               =\u003e '/js/admin.js', // Your custom javascript. Comment out to only use the default js.\n      'template'         =\u003e 'recharge', // Change the theme the settings uses. Comment out to use the default or enter 'default'\n      'support'          =\u003e 'https://www.polyplugins.com/support/', // Your support link. Comment out to have no support link.\n      'action_links' =\u003e array( // Optional, add action links to the listing on admin plugins page\n        array(\n          // Generates url for settings automatically\n          'label'    =\u003e __('Settings', 'test-plugin'),\n          'style'    =\u003e 'color: orange; font-weight: 700;',\n          'external' =\u003e false\n        ),\n        array(\n          'url'      =\u003e 'https://www.polyplugins.com',\n          'label'    =\u003e __('Go Pro', 'test-plugin'),\n          'style'    =\u003e 'color: green; font-weight: 700;',\n          'external' =\u003e true\n        ),\n      ),\n      'meta_links' =\u003e array( // Optional, add meta links to the listing on admin plugins page\n        array(\n          'url'      =\u003e 'https://github.com/users/PolyPlugins/projects/4',\n          'label'    =\u003e __('Roadmap', 'test-plugin'),\n          'style'    =\u003e 'color: purple; font-weight: 700;',\n          'external' =\u003e true\n        ),\n        array(\n          // Generates url for support automatically\n          'label'    =\u003e __('Support', 'test-plugin'),\n          'style'    =\u003e 'font-weight: 700;',\n          'external' =\u003e true\n        ),\n      ),\n      'sidebar' =\u003e array( // Optional, add a permanent sidebar\n        'heading'      =\u003e __('Something Not Working?', 'test-plugin'),\n        'body'         =\u003e __('Feel free to reach out!', 'test-plugin'),\n        'button_label' =\u003e __('Email Us', 'test-plugin'),\n        'button_url'   =\u003e 'https://www.polyplugins.com/contact/'\n      ),\n    );\n\n    $this-\u003efields = array(\n      'general' =\u003e array(\n        'icon' =\u003e 'gear-fill',\n        'fields' =\u003e array(\n          array(\n            'name'     =\u003e __('Enabled', 'test-plugin'),\n            'type'     =\u003e 'switch',\n            'default'  =\u003e false,\n          ),\n          array(\n            'name'      =\u003e __('Button', 'test-plugin'),\n            'label'     =\u003e __('Dual Buttons', 'test-plugin'),\n            'type'      =\u003e 'button',\n            'data'      =\u003e array(\n              array(\n                'title' =\u003e __('Action 1', 'test-plugin'), // general-action-1 would be the id you'd target in js\n                'class' =\u003e 'primary',\n                ),\n              array(\n                'title'  =\u003e __('Action 2', 'test-plugin'),\n                'class'  =\u003e 'secondary',\n                'url'    =\u003e 'https://www.polyplugins.com', // If no url then javascript:void(0) is used, this is useful for custom js\n                'target' =\u003e '_blank',\n              )\n            )\n          ),\n          array(\n            'name'        =\u003e __('Username', 'test-plugin'),\n            'label'       =\u003e __('The Username', 'test-plugin'),\n            'description' =\u003e __('Enter a description.', 'test-plugin'),\n            'type'        =\u003e 'text',\n            'placeholder' =\u003e __('Enter your username...', 'test-plugin'),\n            'default'     =\u003e false,\n            'help'        =\u003e __('Enter a username.', 'test-plugin'),\n          ),\n          array(\n            'name'     =\u003e __('Textarea', 'test-plugin'),\n            'type'     =\u003e 'textarea',\n            'default'  =\u003e __('Description goes here...', 'test-plugin'),\n\n            'help'     =\u003e __('Enter a description.', 'test-plugin'),\n          ),\n          array(\n            'name'     =\u003e __('Larger Textarea', 'test-plugin'),\n            'type'     =\u003e 'textarea',\n            'rows'     =\u003e 6,\n            'default'  =\u003e __('Description goes here...', 'test-plugin'),\n\n            'help'     =\u003e __('Enter a description.', 'test-plugin'),\n          ),\n          array(\n            'name'     =\u003e __('Email', 'test-plugin'),\n            'type'     =\u003e 'email',\n            'default'  =\u003e 'test@example.com',\n            'help'     =\u003e __('Enter your email...', 'test-plugin'),\n          ),\n          array(\n            'name'     =\u003e __('URL', 'test-plugin'),\n            'type'     =\u003e 'url',\n            'default'  =\u003e false,\n            'help'     =\u003e __('Enter a URL. Ex: https://www.example.com', 'test-plugin'),\n          ),\n          array(\n            'name'     =\u003e __('Password', 'test-plugin'),\n            'type'     =\u003e 'password',\n            'default'  =\u003e 'test',\n            'help'     =\u003e __('Enter a password. Note: This is stored in the DB as plain text as most other plugins do, we will change this if requested.', 'test-plugin'),\n          ),\n          array(\n            'name'     =\u003e __('Number', 'test-plugin'),\n            'type'     =\u003e 'number',\n            'min'      =\u003e 1,\n            'max'      =\u003e 10,\n            'step'     =\u003e 2,\n            'default'  =\u003e false,\n            'help'     =\u003e __('Enter a number.', 'test-plugin'),\n            'required' =\u003e true,\n          ),\n          array(\n            'name'     =\u003e __('Time', 'test-plugin'),\n            'type'     =\u003e 'time',\n            'default'  =\u003e false,\n            'help'     =\u003e __('Select a time.', 'test-plugin'),\n          ),\n          array(\n            'name'     =\u003e __('Date', 'test-plugin'),\n            'type'     =\u003e 'date',\n            'default'  =\u003e false,\n            'help'     =\u003e __('Select a date.', 'test-plugin'),\n          ),\n          array(\n            'name'     =\u003e __('Color Picker', 'test-plugin'),\n            'type'     =\u003e 'color',\n            'default'  =\u003e '#00ff00',\n            'help'     =\u003e __('Select a color.', 'test-plugin'),\n          ),\n          array(\n            'name'     =\u003e __('Dropdown', 'test-plugin'),\n            'type'     =\u003e 'dropdown',\n            'options'  =\u003e array(__('Red', 'test-plugin'), __('Blue', 'test-plugin')),\n            'default'  =\u003e false,\n            'help'     =\u003e __('Select an option from the dropdown.', 'test-plugin'),\n          ),\n          array(\n            'name'     =\u003e __('Disabled Dropdown', 'test-plugin'),\n            'type'     =\u003e 'dropdown',\n            'options'  =\u003e array(__('Red', 'test-plugin'), __('Blue', 'test-plugin')),\n            'default'  =\u003e false,\n            'disabled' =\u003e true,\n            'help'     =\u003e __('Select an option from the dropdown.', 'test-plugin'),\n          ),\n        ),\n        'subsections' =\u003e array(\n          'debug' =\u003e array(\n            'icon'  =\u003e 'bug-fill',\n            'label' =\u003e __('Debug', 'test-plugin'),\n            'fields' =\u003e array(\n              array(\n                'name'    =\u003e __('Debug Mode', 'test-plugin'),\n                'type'    =\u003e 'switch',\n                'default' =\u003e false,\n              ),\n            )\n          ),\n        ),\n      ),\n      'api' =\u003e array(\n        'icon' =\u003e 'cloud-arrow-up-fill',\n        'note' =\u003e array(\n          'message' =\u003e __('Use notes to display messages about specific sections', 'test-plugin'),\n          'class'   =\u003e 'warning', // Use success, warning, or error\n        ),\n        'fields' =\u003e array(\n          array(\n            'name'     =\u003e __('Dropdown Toggle', 'test-plugin'),\n            'type'     =\u003e 'dropdown_toggle',\n            'options'  =\u003e array(\n              'Production' =\u003e array(\n                'name'     =\u003e __('API Key', 'test-plugin'),\n                'type'     =\u003e 'text',\n              ),\n              'Development' =\u003e array(\n                'name'     =\u003e __('API Key', 'test-plugin'),\n                'type'     =\u003e 'text',\n              )\n            ),\n          ),\n        ),\n      )\n    );\n  }\n  \n  public function init(){\n    add_action('init', array($this, 'loaded'));\n  }\n\n  public function loaded() {\n    if (!class_exists('Settings')) {\n      $this-\u003esettings = new Settings($this-\u003eplugin, $this-\u003enamespace, $this-\u003econfig, $this-\u003efields);\n      $this-\u003esettings-\u003einit();\n    }\n  }\n\n}\n\n$test_plugin = new Test_Plugin;\n$test_plugin-\u003einit();\n```\n\nYou'll need to run ```composer require polyplugins/settings-class-for-wordpress``` within the test-plugin directory. After that you can activate the plugin and see the settings under Settings -\u003e Test Plugin in the backend of WordPress.\n\n## Roadmap\nCheck out our [Roadmap](https://github.com/users/PolyPlugins/projects/4) to see our upcoming features!\n\n## Consider Contributing\nWe know this class will be useful to many in cutting down development times, but we would love help from the community. We are actively using this class for our software and will continue to build off of it, but we know it can become something greater, faster, with the help of the community. Feel free to submit a PR or submit any issues you have as we will be actively maintaining this.\n\n## GDPR\nWe are not lawyers and always recommend doing your own compliance research into third party plugins, libraries, ect, as we’ve seen other libraries not be in compliance with these regulations.\n\nThis library uses the Bootstrap, BootStrap Icons, and SweetAlert2 3rd party libraries. These libraries are loaded locally to be compliant with data protection regulations.\n\nThis library collects and stores certain data on your server to ensure proper functionality. This includes:\n\n* Storing plugin settings\n* Remembering which notices have been dismissed\n\n## Contributors\n[Rush Frisby](https://github.com/rushfrisby/) - Bootstrap Container\n\n## Changelog\n\n### 3.0.0\n* Added: Subsections\n* Added: Templating\n* Added: Ability to add your own settings_name in config.\n* Added: Additional 'note' attribute to sections to have a note appear at the top of the section\n* Added: Additional 'description' attribute to fields\n* Added: Separators between fields\n* Added: Ability to add action links and meta links with config\n* Added: Sidebar\n* Added: Sidebar config\n* Added: Recharge template\n* Updated: Positioning of save button and credit\n* Updated: Default template to have the fields below the name as having the label next to the fields took up too much space\n* Updated: Bootstrap\n* Bugfix: Settings name generation\n* Removed: Excess properties that were really only required for checking if Reusable Admin Panel was activated, but since this class is just included in all plugins, those properties are no longer needed. This makes instantiating the class shorter with less defining of properties.\n* Removed: Reusable Admin Panel checks\n* Reworked: Auto settings_name generation.\n\n### 2.0.0\n* Added: Composer\n* Added: Ability to use icons in tab navigator\n* Added: Bootstrap Icons\n* Added: All the features from latest Reusable Admin Panel so code base is current\n* Bugfix: Dropdown select preventing load\n* Removed: Font Awesome Icons\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyplugins%2Fsettings-class-for-wordpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolyplugins%2Fsettings-class-for-wordpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyplugins%2Fsettings-class-for-wordpress/lists"}