alexrah/wp-admin-settings

Helper Class to create Wordpress Admin settings panels

2.2.0 2024-02-20 14:05 UTC

This package is auto-updated.

Last update: 2024-06-20 14:55:32 UTC


README

About

Helper class to create wp-admin setting dashboards

Install with Composer

composer require alexrah/wp-admin-settings

Usage

Initialize and configure options

use WpAdminSettings\WpAdminSettings;

const OPTION_NAME = 'wp_option_name';

$oSettings = new WpAdminSettings([
	'label' => 'Option Panel Heading',
	'options_name' => OPTION_NAME,
	'capability' => 'update_themes'
]);

$oSettings->set_option(['name' => 'single_option_name','label' => 'Paypal Client ID','required' => true]);

$oSettings->create();

retrieve single option

WpAdminSettings\WpAdminSettings::get_stored_option(OPTION_NAME,'single_option_name');

retrieve all options

WpAdminSettings\WpAdminSettings::get_stored_option(OPTION_NAME);

Changelog

Version 2.0.0

  • PHP8 ready
  • remove external deps
  • update code to make it more generic