{"id":49572900,"url":"https://github.com/th23x/th23-admin","last_synced_at":"2026-05-03T15:36:39.380Z","repository":{"id":250901359,"uuid":"835573598","full_name":"th23x/th23-admin","owner":"th23x","description":"Admin framework / boilerplate with easy re-usable functionality for WordPress plugins","archived":false,"fork":false,"pushed_at":"2025-05-13T06:45:19.000Z","size":147,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-13T07:40:42.427Z","etag":null,"topics":["admin","plugin","wordpress"],"latest_commit_sha":null,"homepage":"https://th23.net","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/th23x.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":"2024-07-30T05:46:30.000Z","updated_at":"2025-05-13T06:44:22.000Z","dependencies_parsed_at":"2024-07-30T18:56:35.252Z","dependency_job_id":"3913742f-51ec-448a-935e-b016d7871a49","html_url":"https://github.com/th23x/th23-admin","commit_stats":null,"previous_names":["th23x/th23-admin"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/th23x/th23-admin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/th23x%2Fth23-admin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/th23x%2Fth23-admin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/th23x%2Fth23-admin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/th23x%2Fth23-admin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/th23x","download_url":"https://codeload.github.com/th23x/th23-admin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/th23x%2Fth23-admin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32575114,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","plugin","wordpress"],"created_at":"2026-05-03T15:36:38.900Z","updated_at":"2026-05-03T15:36:39.369Z","avatar_url":"https://github.com/th23x.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🛠️ th23 Admin\n\nAdmin framework / boilerplate with easy re-usable functionality for Wordpress plugins\n\n\n## 🚀 Introduction\n\nAdding some **single options** to an **existing settings page** in the WP admin area is easy using the \"[register_setting](https://developer.wordpress.org/reference/functions/register_setting/)\" and \"[add_settings_field](https://developer.wordpress.org/reference/functions/add_settings_field/)\" functions.\n\nBut building your own dedicated **plugin settings page** and manage various **settings depending on each other**, ie layered, with some options only relevant depending on a previous choice, can be a more challenging task to achive.\n\nTherefore I developed this comprehensive admin class for my plugins allowing to **quickly define** a relevant and **well structured** settings page for each of my plugins.\n\nThe `th23 Admin` class allows you to\n* Store all settings into one WP option in the database - for **easy loading and access** during plugin execution\n* Define plugin settings via one central array - allowing for a **wide range of default inputs** eg text, radio buttons, checkboxes, dropdowns, lists, as well as **custom rendered content** eg images to select from, etc\n* Show **settings and support** opportunities prominently on the plugin overview page as well as the plugin settings page\n* Use **install / uninstall / upgrade** routines efficiently - to execute code when your plugin is added / removed / updated\n* Allow hosting and updates from **non-WP.org repositories** - giving you full flexibility for private plugins, paid extensions, or simply platform independency\n* Enable **plugin update detection** via plugin version stored with settings - to allow specific code running after updates to eg change database structure or previous settings\n* Add **screen options and help tabs** to your plugins settings page\n\n\n## ⚙️ Setup\n\nThe folder / file structure of your plugin when adding `th23 Admin` class should look something like this:\n```\ninc/\n   th23-admin-class.php\n   th23-admin-class.js\n   th23-admin-class.css\nth23-example.php\nth23-example-admin.php\nth23-example-upgrade.php [optional]\n...\n```\n\nThe `/inc` folder contains the whole `th23 Admin` script and its accompanying JS and CSS files, thus being separated from your plugin code and keeping it easy to change / update later on.\n\nIn the `th23-example.php`, as the main plugin file with your plugins functionality, simply add the following code to setup / initialize the `th23 Admin` class:\n```\n$th23_example_path = plugin_dir_path(__FILE__);\n\n// Load additional admin class, if required...\nif(is_admin() \u0026\u0026 file_exists($th23_example_path . 'th23-example-admin.php')) {\n\trequire($th23_example_path . 'th23-example-admin.php');\n\t$th23_example = new th23_example_admin();\n}\n// ...or initiate plugin directly\nelse {\n\t$th23_example = new th23_example();\n}\n```\n\n\u003e [!TIP]\n\u003e This example assumes you define and use a frontend class for your plugin as well ie `th23_example`. In this you define some core variables used on both frontend and backend. In such setup the admin class extends the frontend class and both together are initialized.\n\u003e\n\u003e See `th23-example-admin.php` file for more information...\n\n\n## 🖐️ Usage\n\nDefine your plugin settings in the `init_options` function upon loading the `th23 Admin` class from your plugins admin file (`th23-example-admin.php` in the example above).\n\nSee `th23-example-admin.php` file in this repository for an extensive description of the possibilities - no worries, your file might be much shorter as many options can be defined much swifter and without such extensive comments, eg like this one:\n```\n// example: for a short notation of a plugin option, storing a string value as \"pre_subject\" option\n$this-\u003eplugin['options']['pre_subject'] = array(\n\t'title' =\u003e  __('Subject prefix', 'th23-example'),\n\t'default' =\u003e '',\n\t'description' =\u003e __('Optional prefix to be added before the subject of mails sent from the contact form', 'th23-example'),\n);\n```\n\n\u003e [!TIP]\n\u003e Ensure you have covered everything labeled as `required:` in the `th23-example-admin.php` file, while other things are `optional:` or even only `èxamples:` you can look at!\n\n**Access setting values** in your main plugin by simply using the default `get_option` function, which returns an indexed array, with the indexes being the defined `plugin_option_ident` names (in the example above `pre_subject`):\n```\n$options = (array) get_option($this-\u003eplugin['slug']);\n\nprint_r($options); // echo options array\n```\n\n\n## 🤝 Contributors\n\nFeel free to [raise issues](https://github.com/th23x/th23-admin/issues) or [contribute code](https://github.com/th23x/th23-admin/pulls) for improvements via GitHub.\n\n\n## ©️ License\n\nYou are free to use this code in your projects as per the `GNU General Public License v3.0`. References to this repository are of course very welcome in return for my work 😉\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fth23x%2Fth23-admin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fth23x%2Fth23-admin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fth23x%2Fth23-admin/lists"}