Skip to content

Framework Configuration

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

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

php

themeplus_framework_config([

    // ── Basic ────────────────────────────────────────────────
    'display_name'    => 'Nijhum Theme',       // Your theme name — used in menu titles
    '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',    // URL slug for the admin page
    'menu_title'      => 'Nijhum Settings',    // Sidebar menu label
    'page_title'      => 'Nijhum Options',     // Browser tab / page title
    'menu_icon'       => 'dashicons-admin-appearance', // Dashicon or custom SVG
    'menu_position'   => 61,                   // Position in the admin sidebar
    'capability'      => 'edit_theme_options', // Required user capability

    // ── Features ─────────────────────────────────────────────
    'admin_bar'       => true,                 // Show quick-access link in admin bar
    'show_search'     => true,                 // Enable live field search
    'dev_mode'        => defined('WP_DEBUG') && WP_DEBUG,

    // ── i18n ─────────────────────────────────────────────────
    'text_domain'     => 'nijhum',             // Your theme's text domain

]);

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.

php

'display_name' => 'Nijhum Theme',

opt_name

Type: string

The WordPress option key used to store all theme settings in the database. This value is 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.

php

'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.

php

'menu_slug' => 'nijhum-settings',

menu_title

Type: string

The label shown in the WordPress admin sidebar menu.

php

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

page_title

Type: string

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

php

'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.

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.

php

'menu_position' => 61,

capability

Type: string — Default: manage_options

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

php

'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.

php

'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.

php

'show_search' => true,

dev_mode

Type: bool — Default: false

When true, the Developer Panel section appears in the sidebar showing field metadata, current values, and PHP code snippets for every registered field. Always tie this to WP_DEBUG so it never appears in production.

php

'dev_mode' => defined('WP_DEBUG') && WP_DEBUG,

text_domain

Type: string — Default: themeplus

Your theme’s i18n text domain. Used when ThemePlus generates translatable strings from your config — such as auto-generated menu titles based on display_name.

php

'text_domain' => 'nijhum',

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:

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
dev_modefalse
text_domainthemeplus

On This Page