ThemePlate custom options pages

v2.1.0 2023-03-05 13:16 UTC

This package is auto-updated.

Last update: 2024-11-05 16:54:13 UTC


README

Usage

use ThemePlate\Page\MenuPage;
use ThemePlate\Page\SubMenuPage;

// One-liner
( new MenuPage( 'Theme Options' ) )->setup();
( new SubMenuPage( 'Plugin Settings' ) )->parent( 'plugins.php' )->setup();

Available config

/** https://developer.wordpress.org/reference/functions/add_menu_page/#parameters */
$args = array(
	'menu_title' => 'Site Reports',
	'icon_url'   => 'dashicons-printer',
	'position'   => 2,
);

( new MenuPage( 'Available Reports', $args ) )->setup();


/** https://developer.wordpress.org/reference/functions/add_submenu_page/#parameters */
$args = array(
	// Used as the settings group name
	'menu_slug'  => 'site-reports/print-download',
	'capability' => 'moderate_comments',
);

( new SubMenuPage( 'Print or Download', '', $args ) )->parent( 'site-reports' )->setup();