Skip to content

This repository introduces a PHP class designed to simplify the creation of custom options pages in the WordPress admin interface.

License

Notifications You must be signed in to change notification settings

FmiKL/wp-options-page

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WordPress Options Page

This repository introduces a PHP class designed to simplify the creation of custom options pages in the WordPress admin interface. Ideal for theme and plugin developers, this class enables easy integration of advanced user options.

Features

  • Ease of Options Page Creation: Enables the easy creation of options pages within WordPress.
  • Customizable Fields: Supports various field types such as textarea, select, text, checkbox, email, color, etc.
  • Advanced Media Integration: Specific keywords in placeholders trigger the opening of the WordPress media library.

Installation and Setup

  1. Clone or download this repository into your WordPress environment.
  2. Import the class into your functions.php file or your plugin.
require_once 'path/to/wp-options-page/class-option-page.php';

Usage Example

function add_params_options_page() {
    $option = new Option_Page( 'Params', 'params_options_page' );

    $option->add_field(
        'text',
        'my_param_name',
        array(
            'label'       => 'Name',
            'placeholder' => 'Enter your name',
        )
    );

    $option->add_field(
        'select',
        'my_param_option',
        array(
            'label'   => 'Option',
            'options' => [
                'Option 1',
                'Option 2',
            ],
        )
    );

    $option->add_field(
        'url',
        'my_param_avatar',
        array(
            'label'       => 'Avatar',
            'placeholder' => 'Select your avatar ~ 100px',
        )
    );
}
add_action( 'init', 'add_params_options_page' );

Contributing

Contributions to improve this project are welcome, whether they be bug fixes, documentation improvements, or new feature suggestions.

License

This project is distributed under the GNU General Public License version 2 (GPL v2).

About

This repository introduces a PHP class designed to simplify the creation of custom options pages in the WordPress admin interface.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published