This repository has been archived by the owner on Jul 26, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Getting Started
Mattias edited this page Oct 13, 2020
·
1 revision
Call wp_theme_settings class in your theme or plugin file like below
$wpts = new wp_theme_settings(
[
'general' => [],
'settingsID' => '',
'settingFields' => [],
'tabs' => [],
'badge' => []
]
);
Read more about capability with WordPress
Key | Type | Required | Default | Options |
---|---|---|---|---|
title | string | no | @theme-name Theme Settings | |
description | string | no | ||
menu_title | string | no | Theme Settings | |
menu_slug | string | no | wp-theme-settings | |
menu_type | string | no | theme | theme options submenu |
menu_parent | string | if menu_type is submenu | ||
capability | string | no | manage_options | |
toolbar | array | no | false | toolbar_title toolbar_image toolbar_href |
notice | boolean | no | true | false |
settingsID is a settings group name (required).
'settingsID' => 'my-theme-settings'
settingFields contains an array with option names (required if building tabs manually).
'settingFields' => []
Read more about WordPress dashicons
'tabs' => [
'general' => []
'text' => 'General',
'dashicon' => 'dashicons-admin-generic',
'tabFields' => []
],
)
Tab with Sections
'tabs' => [
'general' => [
'text' => 'General',
'dashicon' => 'dashicons-admin-generic',
'tabFields' => [],
'sections' => [
'hooks' => [
'text' => 'Hooks',
'tabFields' => []
],
],
],
]
Badge is nice way to display your logo (optional).
Key | Type | Required | Default | Comment |
---|---|---|---|---|
bg-image | uri | no | WPTS logo | Uri to your logo |
bg-color | Hex Color Code | no | #1d6b8e | You must include the hash |
version | string | no | true | true or false |
Example
'badge' => [
'bg-image' => 'http://i.imgur.com/AvANSYy.png',
'bg-color' => '#1d6b8e'
]