Skip to content

Info Field

A non-input display element for showing instructional text, notices, or contextual help inside the options panel.

Overview

The Info field renders a styled notice block — no input, no saved value. It is purely for display purposes inside the options panel. Use it to add context between fields, explain a group of settings, warn about dependencies, or provide usage instructions. Supports plain text and basic HTML.


Field Registration

php

[
    'id'    => 'typography_info',
    'type'  => 'info',
    'title' => __('Typography Settings', 'your-textdomain'),
    'desc'  => __('Changes to typography settings will be reflected across all pages. Google Fonts are loaded automatically.', 'your-textdomain'),
]

Field Options

OptionTypeRequiredDescription
idstringUnique field identifier — not stored, but required for internal rendering
typestringMust be info
titlestringBold heading text shown at the top of the notice
descstringBody text of the notice — supports basic HTML
stylestringNotice style variant — info (default), success, warning, error
requiredarrayConditional logic rules — see Conditional Logic

Return Value

None. The Info field stores no value and returns nothing from themeplus_get_option().


Usage Examples

Basic informational notice

php

[
    'id'    => 'color_info',
    'type'  => 'info',
    'title' => __('Color Settings', 'your-textdomain'),
    'desc'  => __('Set the main brand colors for your theme. These are applied globally via CSS custom properties.', 'your-textdomain'),
]

Warning notice

php

[
    'id'    => 'cache_warning',
    'type'  => 'info',
    'style' => 'warning',
    'title' => __('Caching Notice', 'your-textdomain'),
    'desc'  => __('If you are using a caching plugin, clear your cache after saving changes to see them take effect on the frontend.', 'your-textdomain'),
]

Success notice

php

[
    'id'    => 'setup_complete',
    'type'  => 'info',
    'style' => 'success',
    'desc'  => __('Your theme is configured and ready. Visit your site to see the result.', 'your-textdomain'),
]

Error / dependency notice

php

[
    'id'    => 'woocommerce_required',
    'type'  => 'info',
    'style' => 'error',
    'title' => __('WooCommerce Required', 'your-textdomain'),
    'desc'  => __('The shop settings below require WooCommerce to be installed and activated.', 'your-textdomain'),
]

With HTML in desc

php

[
    'id'    => 'font_info',
    'type'  => 'info',
    'desc'  => __('Choose fonts from the <strong>Google Fonts</strong> library. Browse available fonts at <a href="https://fonts.google.com" target="_blank" rel="noopener noreferrer">fonts.google.com</a>.', 'your-textdomain'),
]

As a section divider with a conditional

php

[
    'id'      => 'enable_custom_fonts',
    'type'    => 'toggle',
    'title'   => __('Enable Custom Fonts', 'your-textdomain'),
    'default' => false,
],
[
    'id'       => 'custom_fonts_info',
    'type'     => 'info',
    'style'    => 'info',
    'desc'     => __('Select a Google Font for each text element below. Fonts are loaded automatically — no extra setup needed.', 'your-textdomain'),
    'required' => ['enable_custom_fonts', '==', true],
],
[
    'id'       => 'body_typography',
    'type'     => 'typography',
    'title'    => __('Body Typography', 'your-textdomain'),
    'required' => ['enable_custom_fonts', '==', true],
],

Notes

  • The id must still be unique within the section even though the field stores no value.
  • The style option controls the visual appearance of the notice block — use warning or error to draw attention to important dependencies or limitations.
  • Basic HTML tags like <strong>, <em>, <a>, and <br> are supported in desc. Avoid complex markup.
  • Info fields support required conditional logic — use this to show contextual notices only when a related setting is active.

On This Page