Skip to content

schlessera/better-settings-v1

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 

Example Code: Settings Page - Better Implementation v1

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

This is more of a real OOP implementation of a settings page using the WordPress Settings API. In addition to the previous example, it uses a Config file to make the SettingsPage class truly reusable.

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-better-v1.

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

About

Example Code: Settings Page - Better Implementation v1

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages