An open API service indexing awesome lists of open source software.

https://github.com/schlessera/broken-settings-v1

Example Code: Settings Page - Broken Implementation v1
https://github.com/schlessera/broken-settings-v1

hacktoberfest

Last synced: 10 months ago
JSON representation

Example Code: Settings Page - Broken Implementation v1

Awesome Lists containing this project

README

          

# Example Code: Settings Page - Broken Implementation v1

*__This example code is part of the article: [Using A Config To Write Reusable Code](https://www.alainschlesser.com/config-files-for-reusable-code/)__*

This is a very naïve "OOP" implementation of a settings page using the WordPress Settings API.

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 `Settings` → `as-settings-broken-v1`.

![Subpage appearing in the Settings menu](assets/images/screenshot-options-menu.png)

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](assets/images/screenshot-settings-page.png)