Skip to main content

Theme Settings (Components) — functions

25 public functions. 25 are 🔌 pluggable (function_exists()-guarded, so a theme/child can override them).

FunctionSummary
fw_admin_safe_custom_cssMake site Custom CSS wp-admin-safe. misc_custom_css is folded into the shared presets stylesheet, which the page builder ALSO loads in wp-admin (canvas WYSIWYG) — so an unscoped top-level body / html rule (background, overflow, …) would repaint the EDITOR chrome ("the front end leaked into the backend"). This rewrites those global selectors to front-end-only variants (body:not(.wp-admin), html:not(:has(.wp-admin))) so a global rule can never leak into the admin, while class/id/descendant rules (.pb-*, .upwc-*, #x) are left untouched so they still skin the builder canvas. Applies to ALL Custom CSS — hand-written OR emitted by the Site Converter — so this cannot recur regardless of who wrote the CSS. Already-scoped selectors are left alone (idempotent).
unysonplus_collect_preset_leaf_keysWalk an options schema and collect the LEAF option ids (the keys that actually store a value). Containers (tab / box / group) hold no value of their own, so we recurse through them. Used by the preset migration to copy exactly the preset keys — and nothing else — out of the legacy extension store.
unysonplus_icons_settings_optionsBuilds the Icons theme-settings options tree (Library/Browse/Upload installer sub-tabs).
unysonplus_migrate_presets_to_theme_storeOne-time move of saved presets from the legacy theme-INDEPENDENT store (fw_ext_settings_options:shortcodes) into the CURRENT theme's theme-scoped settings (fw_theme_settings_options:{theme-id}). Runs once; the legacy store is left intact as a backup. Only seeds keys not already present in the theme store, and only the preset leaf keys (the Smooth Scroll toggle stays put).
unysonplus_presets_in_theme_settings_enabledPresets are surfaced unless the page builder's "bare" mode (Styling Presets off) is active — matching the old dedicated page's gate.
unysonplus_settings_io_canReturns whether the current user may export or import theme settings.
unysonplus_settings_io_exclude_keysReturns the filterable list of operational setting keys excluded from a design export/import.
unysonplus_settings_io_exportHandles the theme-settings export request, emitting a JSON design envelope as a file download.
unysonplus_settings_io_importHandles the theme-settings import request, validating the uploaded design file and merging its values.
unysonplus_settings_io_misc_field_htmlRenders the Export/Import design control (buttons plus file picker) for the Misc settings tab.
unysonplus_settings_io_page_slugReturns the Theme Settings admin page slug.
unysonplus_settings_io_page_urlReturns the admin URL of the Theme Settings page.
unysonplus_settings_io_redirectRedirects back to the Theme Settings page with the given result code, then exits.
unysonplus_settings_io_result_noticePrints the admin notice reflecting the outcome of a theme-settings import redirect.
unysonplus_settings_io_strip_mediaRecursively strips media/attachment values from a settings array so exports carry no uploaded images.
unysonplus_settings_io_theme_metaReturns the active theme's id and version for the export envelope.
upw_ts_custom_cssReturns the site-wide custom CSS from Theme Settings, sanitized, or an empty string.
upw_ts_get_optionsLoad a built-in Theme Settings section file and return its $options array.
upw_ts_image_size_crop_mapSaved crop value → add_image_size() $crop argument.
upw_ts_maintenance_user_is_allowedReturns whether the current logged-in user has a role allowed to bypass maintenance mode.
upw_ts_merge_into_miscMerge built-in sub-tabs into the Miscellaneous section of the Theme Settings options (the section keyed misc_container, whose sub-tabs live inside its box container). If the active theme provides no Miscellaneous section (e.g. a non-Unyson theme), a Miscellaneous section is created to host them.
upw_ts_misc_subtabsBuilt-in Miscellaneous sub-tabs (ported from the theme so they work under any theme). Each is a tab -> box wrapping the feature's schema file. Merged into the theme's Miscellaneous section by the fw_settings_options filter below.
upw_ts_register_image_sizesRegisters custom image sizes defined in Theme Settings via add_image_size, skipping reserved or invalid entries.
upw_ts_selectable_image_sizesExpose custom sizes (with "Show in editor" on) in the media / block-editor size dropdown. Without this a registered size is usable only from template code.
upw_ts_settingRead a leaf value out of a multi container saved in the Theme Settings store (fw_theme_settings_options:{theme-id}). Mirrors the theme's unysonplus_misc_get() read path so the plugin's built-in Miscellaneous features reuse the SAME storage keys (zero migration) and work under any theme.

fw_admin_safe_custom_css

🔌 pluggable

fw_admin_safe_custom_css( $css )

Make site Custom CSS wp-admin-safe. misc_custom_css is folded into the shared presets stylesheet, which the page builder ALSO loads in wp-admin (canvas WYSIWYG) — so an unscoped top-level body / html rule (background, overflow, …) would repaint the EDITOR chrome ("the front end leaked into the backend"). This rewrites those global selectors to front-end-only variants (body:not(.wp-admin), html:not(:has(.wp-admin))) so a global rule can never leak into the admin, while class/id/descendant rules (.pb-*, .upwc-*, #x) are left untouched so they still skin the builder canvas. Applies to ALL Custom CSS — hand-written OR emitted by the Site Converter — so this cannot recur regardless of who wrote the CSS. Already-scoped selectors are left alone (idempotent).

ParameterTypeDescription
$cssstring

Returns string

Source: framework/extensions/shortcodes/includes/theme-settings/miscellaneous-handlers.php:30

unysonplus_collect_preset_leaf_keys

🔌 pluggable

unysonplus_collect_preset_leaf_keys( array $options, array &$keys )

Walk an options schema and collect the LEAF option ids (the keys that actually store a value). Containers (tab / box / group) hold no value of their own, so we recurse through them. Used by the preset migration to copy exactly the preset keys — and nothing else — out of the legacy extension store.

ParameterTypeDescription
$optionsarrayOptions array.
$keysarrayAccumulator (id => true), passed by reference.

Source: framework/extensions/shortcodes/includes/theme-settings/helpers.php:120

unysonplus_icons_settings_options

🔌 pluggable

unysonplus_icons_settings_options()

Builds the Icons theme-settings options tree (Library/Browse/Upload installer sub-tabs).

Source: framework/extensions/shortcodes/includes/theme-settings/icons.php:17

unysonplus_migrate_presets_to_theme_store

🔌 pluggable

unysonplus_migrate_presets_to_theme_store()

One-time move of saved presets from the legacy theme-INDEPENDENT store (fw_ext_settings_options:shortcodes) into the CURRENT theme's theme-scoped settings (fw_theme_settings_options:{theme-id}). Runs once; the legacy store is left intact as a backup. Only seeds keys not already present in the theme store, and only the preset leaf keys (the Smooth Scroll toggle stays put).

Source: framework/extensions/shortcodes/includes/theme-settings/loader.php:324

unysonplus_presets_in_theme_settings_enabled

🔌 pluggable

unysonplus_presets_in_theme_settings_enabled()

Presets are surfaced unless the page builder's "bare" mode (Styling Presets off) is active — matching the old dedicated page's gate.

Source: framework/extensions/shortcodes/includes/theme-settings/loader.php:82

unysonplus_settings_io_can

🔌 pluggable

unysonplus_settings_io_can()

Returns whether the current user may export or import theme settings.

Source: framework/extensions/shortcodes/includes/theme-settings/settings-export-import.php:53

unysonplus_settings_io_exclude_keys

🔌 pluggable

unysonplus_settings_io_exclude_keys()

Returns the filterable list of operational setting keys excluded from a design export/import.

Source: framework/extensions/shortcodes/includes/theme-settings/settings-export-import.php:24

unysonplus_settings_io_export

🔌 pluggable

unysonplus_settings_io_export()

Handles the theme-settings export request, emitting a JSON design envelope as a file download.

Source: framework/extensions/shortcodes/includes/theme-settings/settings-export-import.php:96

unysonplus_settings_io_import

🔌 pluggable

unysonplus_settings_io_import()

Handles the theme-settings import request, validating the uploaded design file and merging its values.

Source: framework/extensions/shortcodes/includes/theme-settings/settings-export-import.php:144

unysonplus_settings_io_misc_field_html

🔌 pluggable

unysonplus_settings_io_misc_field_html()

Renders the Export/Import design control (buttons plus file picker) for the Misc settings tab.

Source: framework/extensions/shortcodes/includes/theme-settings/settings-export-import.php:252

unysonplus_settings_io_page_slug

🔌 pluggable

unysonplus_settings_io_page_slug()

Returns the Theme Settings admin page slug.

Source: framework/extensions/shortcodes/includes/theme-settings/settings-export-import.php:60

unysonplus_settings_io_page_url

🔌 pluggable

unysonplus_settings_io_page_url()

Returns the admin URL of the Theme Settings page.

Source: framework/extensions/shortcodes/includes/theme-settings/settings-export-import.php:70

unysonplus_settings_io_redirect

🔌 pluggable

unysonplus_settings_io_redirect( $code )

Redirects back to the Theme Settings page with the given result code, then exits.

Source: framework/extensions/shortcodes/includes/theme-settings/settings-export-import.php:87

unysonplus_settings_io_result_notice

🔌 pluggable

unysonplus_settings_io_result_notice()

Prints the admin notice reflecting the outcome of a theme-settings import redirect.

Source: framework/extensions/shortcodes/includes/theme-settings/settings-export-import.php:217

unysonplus_settings_io_strip_media

🔌 pluggable

unysonplus_settings_io_strip_media( $value )

Recursively strips media/attachment values from a settings array so exports carry no uploaded images.

Source: framework/extensions/shortcodes/includes/theme-settings/settings-export-import.php:38

unysonplus_settings_io_theme_meta

🔌 pluggable

unysonplus_settings_io_theme_meta()

Returns the active theme's id and version for the export envelope.

Source: framework/extensions/shortcodes/includes/theme-settings/settings-export-import.php:77

upw_ts_custom_css

🔌 pluggable

upw_ts_custom_css()

Returns the site-wide custom CSS from Theme Settings, sanitized, or an empty string.

Source: framework/extensions/shortcodes/includes/theme-settings/miscellaneous-handlers.php:69

upw_ts_get_options

🔌 pluggable

upw_ts_get_options( $name, array $variables = array() )

Load a built-in Theme Settings section file and return its $options array.

(e.g. 'components-color', 'miscellaneous-performance'). 'color_choices', 'gap_choices'). Mirrors the $variables arg of fw()->theme->get_options().

ParameterTypeDescription
$namestringFile name without extension, relative to this folder
$variablesarrayExtra variables made available inside the file (e.g.

Returns array

Source: framework/extensions/shortcodes/includes/theme-settings/helpers.php:26

upw_ts_image_size_crop_map

🔌 pluggable

upw_ts_image_size_crop_map()

Saved crop value → add_image_size() $crop argument.

Source: framework/extensions/shortcodes/includes/theme-settings/miscellaneous-handlers.php:337

upw_ts_maintenance_user_is_allowed

🔌 pluggable

upw_ts_maintenance_user_is_allowed()

Returns whether the current logged-in user has a role allowed to bypass maintenance mode.

Source: framework/extensions/shortcodes/includes/theme-settings/miscellaneous-handlers.php:229

upw_ts_merge_into_misc

🔌 pluggable

upw_ts_merge_into_misc( array $options, array $subtabs )

Merge built-in sub-tabs into the Miscellaneous section of the Theme Settings options (the section keyed misc_container, whose sub-tabs live inside its box container). If the active theme provides no Miscellaneous section (e.g. a non-Unyson theme), a Miscellaneous section is created to host them.

ParameterTypeDescription
$optionsarrayThe full Theme Settings options (list of nav sections).
$subtabsarraytab_id => tab-definition entries to append.

Returns array

Source: framework/extensions/shortcodes/includes/theme-settings/helpers.php:81

upw_ts_misc_subtabs

🔌 pluggable

upw_ts_misc_subtabs()

Built-in Miscellaneous sub-tabs (ported from the theme so they work under any theme). Each is a tab -> box wrapping the feature's schema file. Merged into the theme's Miscellaneous section by the fw_settings_options filter below.

Returns array tab_id => tab-definition.

Source: framework/extensions/shortcodes/includes/theme-settings/loader.php:42

upw_ts_register_image_sizes

🔌 pluggable

upw_ts_register_image_sizes()

Registers custom image sizes defined in Theme Settings via add_image_size, skipping reserved or invalid entries.

Source: framework/extensions/shortcodes/includes/theme-settings/miscellaneous-handlers.php:356

upw_ts_selectable_image_sizes

🔌 pluggable

upw_ts_selectable_image_sizes( $sizes )

Expose custom sizes (with "Show in editor" on) in the media / block-editor size dropdown. Without this a registered size is usable only from template code.

ParameterTypeDescription
$sizesarrayslug => label map WordPress offers in the picker.

Returns array

Source: framework/extensions/shortcodes/includes/theme-settings/miscellaneous-handlers.php:386

upw_ts_setting

🔌 pluggable

upw_ts_setting( $bucket, $key, $default = '' )

Read a leaf value out of a multi container saved in the Theme Settings store (fw_theme_settings_options:{theme-id}). Mirrors the theme's unysonplus_misc_get() read path so the plugin's built-in Miscellaneous features reuse the SAME storage keys (zero migration) and work under any theme.

ParameterTypeDescription
$bucketstringThe multi container id (e.g. 'misc_custom_css').
$keystringThe leaf id inside it (e.g. 'custom_css').
$defaultmixedReturned when unset/empty.

Returns mixed

Source: framework/extensions/shortcodes/includes/theme-settings/helpers.php:51

← Back to Functions overview