https://github.com/fmikl/wp-options-page
A lightweight PHP class for creating custom options pages in the WordPress admin area.
https://github.com/fmikl/wp-options-page
wordpress-developer wordpress-development wordpress-theme
Last synced: 2 months ago
JSON representation
A lightweight PHP class for creating custom options pages in the WordPress admin area.
- Host: GitHub
- URL: https://github.com/fmikl/wp-options-page
- Owner: FmiKL
- License: gpl-2.0
- Created: 2023-11-23T14:23:02.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-02-09T07:58:12.000Z (4 months ago)
- Last Synced: 2026-02-09T13:30:58.500Z (4 months ago)
- Topics: wordpress-developer, wordpress-development, wordpress-theme
- Language: PHP
- Homepage:
- Size: 27.3 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WordPress Options Page
A lightweight PHP class for creating custom options pages in the WordPress admin area.
## Features
- Text, email, url, number, color, checkbox, textarea, select fields
- Group fields into sections
- Media library integration via placeholder keywords
- Automatic image size selection
- Built-in sanitization per field type
## Setup
```php
require_once 'path/to/wp-options-page/class-option-page.php';
```
## Usage
```php
$option = new Option_Page( 'Site Settings', 'site_settings' );
$option->add_section( 'general', 'General' );
$option->add_field( 'text', 'site_tagline', array( 'label' => 'Tagline', 'section' => 'general' ) );
$option->add_field( 'color', 'brand_color', array( 'label' => 'Brand color', 'section' => 'general' ) );
$option->add_field( 'email', 'contact_email', array( 'label' => 'Email' ) );
$option->add_field( 'select', 'layout', array( 'label' => 'Layout', 'choices' => array( 'grid', 'list' ) ) );
```
## License
[GPL v2](LICENSE)