Skip to content

Framework Configuration

How to configure ThemePlus for your theme using themeplus_framework_config().

How to configure ThemePlus for your theme using themeplus_framework_config().

Overview

themeplus_framework_config() is the single function that tells ThemePlus who it belongs to. Call it once from your theme’s after_setup_theme hook and ThemePlus will use your theme’s name, menu slug, option key, and icon throughout — making the options panel appear entirely under your theme’s identity.

Basic Example

📄<code>php
add_action( 'after_setup_theme', function () {

    if ( ! function_exists( 'themeplus_framework_config' ) ) {
        return;
    }

    $theme = wp_get_theme();

    themeplus_framework_config([
        'display_name' => $theme->get( 'Name' ),
        'opt_name'     => 'my_theme_options',
        'menu_slug'    => 'my-theme-settings',
        'menu_title'   => __( 'Theme Settings', 'your-textdomain' ),
        'menu_icon'    => 'dashicons-admin-appearance',
        'text_domain'  => 'your-textdomain',
    ]);

} );

Full Configuration Reference

📄<code>php
themeplus_framework_config([

    // Identity
    'display_name'    => 'Nijhum Theme',              // Your theme name
    'display_version' => '1.0.0',                     // Your theme version (optional)

    // Database
    'opt_name'        => 'nijhum_options',            // MUST be unique per theme

    // Admin menu
    'menu_slug'       => 'nijhum-settings',
    'menu_title'      => __( 'Nijhum Settings', 'nijhum' ),
    'page_title'      => __( 'Nijhum Theme Options', 'nijhum' ),
    'menu_icon'       => 'dashicons-admin-appearance',
    'menu_position'   => 61,
    'capability'      => 'edit_theme_options',

    // Features
    'admin_bar'       => true,
    'show_search'     => true,

    // i18n
    'text_domain'     => 'nijhum',

]);

Configuration Options

display_name

Type: string

Your theme’s display name. When provided, ThemePlus uses it to automatically generate menu_title and page_title if those are not explicitly set.

'display_name' => 'Nijhum Theme',

display_version

Type: string

Your theme’s version string. Optional — used for display purposes only.

'display_version' => '1.0.0',

opt_name

Type: string

The WordPress option key used to store all theme settings in the database. Passed directly to get_option() and update_option().

Important: This must be unique per theme. If two themes share the same opt_name, their settings will collide in the database. Use something specific to your theme — for example nijhum_options or mytheme_v2_options.

'opt_name' => 'nijhum_options',

menu_slug

Type: string

The URL slug for your theme’s options page. Appears in the browser address bar as /wp-admin/admin.php?page=your-slug.

'menu_slug' => 'nijhum-settings',

menu_title

Type: string

The label shown in the WordPress admin sidebar menu.

'menu_title' => __( 'Nijhum Settings', 'nijhum' ),

page_title

Type: string

The title shown in the browser tab and at the top of the admin page.

'page_title' => __( 'Nijhum Theme Options', 'nijhum' ),

menu_icon

Type: string

The icon shown next to the menu label in the admin sidebar. Accepts any WordPress Dashicon slug or a base64-encoded SVG data URI.

📄<code>php
// Dashicon
'menu_icon' => 'dashicons-admin-appearance',

// Custom SVG (base64)
'menu_icon' => 'data:image/svg+xml;base64,...',

menu_position

Type: int — Default: 59

The position of your theme’s menu item in the WordPress admin sidebar. Lower numbers appear higher. Common reference points: Posts = 5, Pages = 20, Appearance = 60, Plugins = 65.

'menu_position' => 61,

capability

Type: string — Default: manage_options

The WordPress capability required to access the options panel and all ThemePlus REST API endpoints. Use manage_options for administrators only, or edit_theme_options to also allow users with the Theme Editor role.

'capability' => 'edit_theme_options',

admin_bar

Type: bool — Default: true

Whether to show a quick-access link to your theme’s options panel in the WordPress admin bar.

'admin_bar' => true,

show_search

Type: bool — Default: true

Whether to show the live search box in the sidebar. When enabled, users can instantly search across all field titles, subtitles, descriptions, and IDs.

'show_search' => true,

text_domain

Type: string — Default: themeplus

Your theme’s i18n text domain. ThemePlus uses this to store a reference to your theme’s domain — but your theme is responsible for translating its own config strings. Every string you pass into themeplus_framework_config() or themeplus_add_section() should already be wrapped in __()with your own text domain. ThemePlus only translates its own internal fallback strings.

'text_domain' => 'nijhum',

Developer Panel and Dev Mode

The Developer Panel activates automatically — you do not need to configure it. ThemePlus detects the development environment behind the scenes using this priority order:

  1. THEMEPLUS_DEV constant in wp-config.php (explicit override, highest priority)
  2. WP_DEBUG = true in wp-config.php
  3. WP_ENVIRONMENT_TYPE = 'local' — set automatically by Local by Flywheel and other local environments

When any of these conditions is met, the Developer Panel section appears in the sidebar automatically. To force it off regardless of environment, define the constant explicitly:

define( 'THEMEPLUS_DEV', false );

See the Developer Panel article for full details.

Safety Check

Always wrap the call in a function_exists() check. This ensures your theme degrades gracefully if ThemePlus is not installed or not yet active:

📄<code>php
if ( ! function_exists( 'themeplus_framework_config' ) ) {
    return;
}

Default Values

If you do not provide a value for an option, ThemePlus falls back to its own defaults:

OptionDefault
opt_namethemeplus_options
menu_slugthemeplus
menu_titleThemePlus
page_titleThemePlus Options
menu_iconThemePlus SVG icon
menu_position59
capabilitymanage_options
admin_bartrue
show_searchtrue
text_domainthemeplus

On This Page