Example Code: Settings Page - Broken Implementation v2
PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
assets/images
src
views
.gitignore
README.md
broken-settings-v2.php
composer.json
composer.lock

README.md

Example Code: Settings Page - Broken Implementation v2

This example code is part of the article: Using A Config To Write Reusable Code

This is an improved "OOP" implementation of a settings page using the WordPress Settings API. It uses separate views to extract (some of) the business logic out of the core SettingsPage class.

To test this plugin yourself, clone the repository into a wp-content/plugins folder of a WordPress installation, and run the command composer install from within the plugin's folder to generate the autoloader. You should then be able to activate the plugin and get access to the generated settings page via Settingsas-settings-broken-v2.

Subpage appearing in the Settings menu

Clicking on this menu entry will bring you to the generated Settings page, which allows you to save two useless settings.

Settings page as it is generated by this plugin