| 开发者 | farukahmed |
|---|---|
| 更新时间 | 2026年6月24日 04:21 |
| PHP版本: | 8.0 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
image returns { id, url, width, height, alt, title } — empty array when no image selectedgallery returns an array of { id, url, alt } rowsborder returns { width, style, color, radius }social_media returns an array of { platform, url } rowsrepeater returns an array of row arrays keyed by sub-field idgradient_picker returns a complete CSS linear-gradient() stringthemeplus_framework_config() with your theme's name, slug, option key, and icon — your users see your theme's own settings panel, never "ThemePlus".
Convention: section and subsection icon takes a FontAwesome name only ('pen'). The Icon field default takes the full FontAwesome class ('fa-solid fa-star'). The plugin translates its own fallback strings; your theme translates its config strings in your own text domain.
Google Fonts + Custom Fonts
The Typography field includes a searchable browser of 1,899 Google Fonts with live preview, weight and style selection, subset support, and automatic font enqueueing on the frontend. Skip Google Fonts entirely and upload self-hosted fonts (WOFF2, WOFF) via the built-in Custom Fonts module — magic-byte verified, capability-gated, and output into @font-face rules automatically.
Note: Custom fonts are stored as Media Library attachments and are not affected by Reset All or Reset Section — use the per-font Delete button to remove uploaded files.
Conditional Logic
Show or hide any field based on the value of another. Supports 10 operators and three relation formats:
Operators: ==, !=, >, <, >=, <=, contains, !contains, empty, !empty
Single condition:
'required' => ['sidebar_position', '==', 'left']
Multiple AND conditions:
'required' => [['enable_header', '==', true], ['header_style', '!=', 'minimal']]
Multiple OR conditions:
'required' => ['relation' => 'OR', 'conditions' => [['mode', '==', 'simple'], ['mode', '==', 'expert']]]
Array value (matches any):
'required' => ['header_elements', 'contains', 'search']
Dot-notation sub-key:
'required' => ['body_typography.font-family', '==', 'Inter']
empty / !empty note: false and 0 are NOT considered empty — only truly absent values, empty strings, empty arrays, and null.
Sections and Subsections
Organize theme options into a hierarchical sidebar. Add sections with themeplus_add_section(), nest subsections inline via the subsections key, or attach subsections from a separate hook with themeplus_add_subsection() — the pattern for child themes and extension plugins.
Import / Export
Backup and restore all theme settings with one click. Import/Export handles JSON serialization and restores defaults cleanly.
REST API
Full REST API under the themeplus/v1 namespace — get options, save options, reset all, reset section, get configuration. All endpoints require the configured capability (default edit_theme_options) with nonce verification. Options are sanitized per field type before storage.
Developer Panel
Enable dev mode (define('THEMEPLUS_DEV', true)) to access a Developer Panel showing every registered field with its current value, PHP data type, and copy-ready code snippets for all three access patterns. Includes field statistics by type and section.
Security
ThemePlus_Sanitizer) — unknown keys are dropped, values are validated against registered field configurationthemeplus.zip from GitHub Releasesincludes/config/sample-config.php from the plugin into your theme (rename my_theme_ prefixes to your own)functions.php: require_once get_template_directory() . '/inc/themeplus-config.php';themeplus_framework_config() with your theme's detailsthemeplus_add_section()themeplus_get_option('field_id')Yes, completely. ThemePlus is open-source and GPL-2.0-or-later. There are no premium tiers, no feature locks, and no license keys.
ThemePlus provides 30 field types, white-label support, conditional logic, Google Fonts, custom fonts, Import/Export, a REST API, and a Developer Panel — all in a modern React UI. It is designed as a complete, standalone theme options solution for WordPress theme developers.
Yes. ThemePlus requires PHP 8.0 or higher and uses PHP 8 type hints, union types, and named arguments throughout.
$value = themeplus_get_option( 'field_id', 'default_value' );
For structured fields like image, border, or repeater, the return value is an array — see the field shapes in the Description section above.
Section and subsection icon takes a FontAwesome name only: 'pen', 'palette', 'code'. The Icon field default takes the full FontAwesome class: 'fa-solid fa-star', 'fa-brands fa-github'. The picker modal handles selection in the UI — the default is only the stored fallback.
Yes. ThemePlus is GPL-licensed and can be bundled with commercial themes. The recommended approach for ThemeForest is TGM Plugin Activation so buyers can install it from your theme package.
The plugin activates per-site. The uninstall routine cleans up options across all sites on the network.
Custom fonts are uploaded files stored in the Media Library — not option values. Reset All and Reset Section only affect your option values. Use the Delete button in the Custom Fonts section to remove uploaded font files. This is intentional: resetting settings should never silently delete uploaded assets.
Yes. Any typography field set to a Google Font is automatically enqueued on the frontend via a combined Google Fonts URL. System fonts and custom uploaded fonts are detected and excluded from the Google Fonts request automatically.
When define('THEMEPLUS_DEV', true) is added to wp-config.php, a Developer Panel appears in the sidebar showing every registered field with its current saved value, PHP data type, dependency metadata, and code snippets for themeplus_get_option(), direct array access, and themeplus_update_option(). Remove the constant on production sites.
Yes — use themeplus_add_subsection( 'parent_section_id', [ ...subsection config... ] ) from your own init hook (priority 20 or later, after the parent section is registered). This is the recommended pattern for child themes and addon plugins extending a parent theme's panel.
No — intentionally. false and 0 are NOT considered empty. Only truly absent values, empty strings, empty arrays, and null trigger empty. This matches PHP's empty() semantics for booleans and integers, which is the least surprising behavior for theme developers.