1. Go to this page and download the library: Download ralfhortt/wp-settings library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use RalfHortt\Settings\SettingsPage;
(new SettingsPage)
->page(
'Theme Configuration',
'Theme Config', // menu title
'my-theme-config', // slug
'edit_theme_options' // capability
)
->themesPage()
->panel('Design Settings')
->section('Colors')
->color('primary-color', 'Primary Color')
->register();
use RalfHortt\Settings\SettingsPage;
// Under Settings (optional — this is the default)
(new SettingsPage)
->page('Plugin Settings')
->optionsPage()
->register();
// Under Appearance
(new SettingsPage)
->page('Theme Options')
->themesPage()
->register();
// Under Tools
(new SettingsPage)
->page('Import / Export')
->toolsPage()
->register();
// Top-level menu item
(new SettingsPage)
->page('Brand Manager')
->topLevel('dashicons-art', 25)
->register();
// Custom parent (WooCommerce products, plugin menus, etc.)
(new SettingsPage)
->page('Product Settings')
->subpageUnder('edit.php?post_type=product')
->register();