themeplate / page
ThemePlate custom options pages
v2.1.0
2023-03-05 13:16 UTC
Requires
- php: ^7.4|^8.0
Requires (Dev)
- themeplate/tester: ^1.3
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();