Bisteinoff exposes configuration as PHP constants. Almost all of them are wrapped in if ( ! defined() ), so you can set a value once — in wp-config.php or in a child theme — and the parent theme will not overwrite it.
Use constants when you want a site-wide switch that is independent of the admin UI: enable multilingual mode, hide an options tab, add extra color slots, or allowlist a third-party CDN. For markup and data that should change at runtime, use theme hooks instead.
Where to define constants
WordPress loads files in this order:
wp-config.php- Must-use plugins, then plugins
- The child theme’s
functions.php(if a child theme is active) - The parent theme’s
functions.php, which then loadsinc/config/constants.php
Because the child theme loads first, a define() at the top of the child functions.php is enough. wp-config.php is even earlier and is the right place for security-related values (CSP whitelist, custom nonce generator) and for flags you want to keep out of version control.
Always define the constant before the parent theme boots. Defining it later has no effect: PHP constants cannot be changed once they exist.
<?php
/**
* Child theme: wp-content/themes/your-child/functions.php
*/
defined( 'ABSPATH' ) || exit;
// Must run before the parent theme loads inc/config/constants.php.
define( 'BISTEINOFF_SITE_MULTILINGUAL', true );
define( 'BISTEINOFF_THEME_DESIGN_COLORS', 5 );
define( 'BISTEINOFF_VERSION_CHILD', '1.2.0' );The same definitions in wp-config.php (above the line /* That's all, stop editing! */):
define( 'BISTEINOFF_SITE_MULTILINGUAL', true );
define( 'BISTEINOFF_WHITELIST', 'https://cdn.jsdelivr.net https://ajax.googleapis.com https://secure.gravatar.com https://maps.googleapis.com' );Feature flags
These are the constants you will set most often in a child theme or on a specific site.
| Constant | Type | Default | Purpose |
|---|---|---|---|
BISTEINOFF_SITE_MULTILINGUAL | bool | false | Turns on the theme’s multilingual module (language switcher, translated fields, locale routing). This is not a replacement for WPML or Polylang content translation. |
BISTEINOFF_CUSTOM_POST_TYPES | array | [] | When non-empty, registers the projects post type. Optionally set a rewrite slug (see example below). Slides, features, FAQ, brands and testimonials are always registered. |
BISTEINOFF_SEO_YANDEX | bool | false | Adds Yandex-oriented noindex rules (paginated archives, author archives, and similar). Has no effect on Google-oriented SEO output. |
BISTEINOFF_USE_JQUERY_MIGRATE | bool | false | Loads jQuery Migrate next to the CDN jQuery bundle. Enable only for legacy plugins that still call deprecated APIs such as .live() or .bind(). |
BISTEINOFF_RUN_LOCALISATION | bool | false | Loads .mo files from the theme’s languages/ directory. Enable only when you manage translations with Poedit rather than WordPress language packs. |
BISTEINOFF_WEATHER_TTL | int | 3600 (not defined until you set it) | Cache lifetime in seconds for the weather API integration. Define this only if the API module is enabled. |
BISTEINOFF_DISPLAY_WOO_CART | bool | From Website Settings → WooCommerce (“disable cart”) | Force the header cart icon on or off, regardless of the admin option. Define it only when WooCommerce is active and you need a hard override. |
BISTEINOFF_USE_GUTENBERG | bool | unset (Gutenberg on by default) | Legacy unsaved default for the block editor. Set to false only on new installs before Design Settings are saved. After the option is stored in the database, this constant is ignored. |
Enable the Projects post type and give it a custom archive slug:
define( 'BISTEINOFF_CUSTOM_POST_TYPES', [
'projects' => [ 'slug' => 'portfolio' ],
] );A non-empty array is enough to register Projects with the default slug projects:
define( 'BISTEINOFF_CUSTOM_POST_TYPES', [ 'projects' => [] ] );Admin options panels
These constants control which tabs appear under Website Settings, and how many slots some features expose. Set them in wp-config.php or the child theme when a site should not offer ads, SEO, API, or extra modals.
| Constant | Type | Default | Purpose |
|---|---|---|---|
BISTEINOFF_THEME_OPTIONS_SEO | bool | true | Shows the SEO tab, post/term SEO metaboxes, and front-end SEO output. Set to false when a dedicated SEO plugin owns titles and meta tags. |
BISTEINOFF_THEME_OPTIONS_API | bool | true | Shows the API tab and loads API integrations (including weather). Set to false on sites that do not use them. |
BISTEINOFF_THEME_OPTIONS_ADS | bool or int | true | Ads feature. false hides it. true enables 2 ad slots (legacy). An integer sets the number of slots, for example 4. |
BISTEINOFF_THEME_OPTIONS_MODALS | int | 3 | How many custom modal slots appear in Website Settings → Modals (in addition to the built-in Contact and Socials modals). |
define( 'BISTEINOFF_THEME_OPTIONS_SEO', false ); // SEO plugin in use
define( 'BISTEINOFF_THEME_OPTIONS_API', false );
define( 'BISTEINOFF_THEME_OPTIONS_ADS', 4 ); // four ad slots
define( 'BISTEINOFF_THEME_OPTIONS_MODALS', 6 );Design and layout
These control how many palette fields Design Settings exposes, and the breakpoint map used by the page builder and responsive helpers.
| Constant | Type | Default | Purpose |
|---|---|---|---|
BISTEINOFF_THEME_DESIGN_COLORS |
int | 7 |
Number of brand color slots in Design Settings. |
BISTEINOFF_THEME_DESIGN_NEUTRAL_COLORS |
int | 9 |
Number of neutral (grey-scale) color slots. |
BISTEINOFF_THEME_DESIGN_GRADIENTS |
int | 3 |
Number of custom gradient slots. |
BISTEINOFF_SCREEN_TYPES |
array | Bootstrap 5 breakpoints | Maps breakpoint name → prefix, description, width. Override only if you replace the Bootstrap grid. |
Default BISTEINOFF_SCREEN_TYPES values:
| Key | Prefix | Width | Description |
|---|---|---|---|
mobile | (none) | 0 | < 576px |
mobile_landscape | sm | 576 | ≥ 576px |
tablet | md | 768 | ≥ 768px |
tablet_landscape | lg | 992 | ≥ 992px |
desktop | xl | 1200 | ≥ 1200px |
large | xxl | 1400 | ≥ 1400px |
define( 'BISTEINOFF_THEME_DESIGN_COLORS', 12 );
define( 'BISTEINOFF_THEME_DESIGN_NEUTRAL_COLORS', 6 );
define( 'BISTEINOFF_THEME_DESIGN_GRADIENTS', 5 );Security
BISTEINOFF_WHITELIST is a space-separated list of origins added to the theme’s Content-Security-Policy (script-src, style-src, font-src, img-src). If you load fonts, maps, or analytics from another host, add that origin here as a full replacement list — you cannot concatenate with the default, because the default does not exist yet when you define the constant.
Default origins: https://cdn.jsdelivr.net, https://ajax.googleapis.com, https://secure.gravatar.com.
// wp-config.php — include the defaults, then append your origins.
define(
'BISTEINOFF_WHITELIST',
'https://cdn.jsdelivr.net https://ajax.googleapis.com https://secure.gravatar.com https://fonts.googleapis.com https://fonts.gstatic.com'
);BISTEINOFF_SCRIPTS_NONCE is a per-request CSP nonce (16 random bytes, base64-encoded) attached to inline scripts. You normally should not override it. If you do, supply a cryptographically random value of your own from wp-config.php.
The theme also sets the WordPress core constant DISALLOW_FILE_EDIT to true if it is not already defined, which disables the plugin and theme file editors in wp-admin. Define it in wp-config.php yourself if you need a different value.
Child theme version badge
Define BISTEINOFF_VERSION_CHILD as a string (for example '1.4.2') to show the child theme version next to the parent version in the theme options footer. The parent version is always read from the parent stylesheet header and should not be overridden.
define( 'BISTEINOFF_VERSION_CHILD', wp_get_theme()->get( 'Version' ) );Path and version constants (read, do not override)
These are defined for the theme’s own use. Reading them from a child theme or plugin is safe. Redefining them is almost never useful and can break asset URLs.
| Constant | Value |
|---|---|
BISTEINOFF_TEMPLATE_DIR | Filesystem path to the parent theme (no trailing slash), same as get_template_directory() |
BISTEINOFF_TEMPLATE_URI | URI of the parent theme, same as get_template_directory_uri() |
BISTEINOFF_ASSETS_DIR | BISTEINOFF_TEMPLATE_DIR . '/assets' |
BISTEINOFF_ASSETS_URI | BISTEINOFF_TEMPLATE_URI . '/assets' |
BISTEINOFF_ADMIN_ASSETS_DIR | BISTEINOFF_TEMPLATE_DIR . '/admin/assets' |
BISTEINOFF_ADMIN_ASSETS_URI | BISTEINOFF_TEMPLATE_URI . '/admin/assets' |
BISTEINOFF_VERSION | Parent theme version from the stylesheet header |
BISTEINOFF_MIN_PHP | '8.2' — not wrapped in defined(); do not redefine |
BISTEINOFF_MIN_WP | '6.5' — not wrapped in defined(); do not redefine |
Example: enqueue a parent-theme stylesheet from a child theme.
add_action( 'wp_enqueue_scripts', function () {
wp_enqueue_style(
'child-extra',
BISTEINOFF_ASSETS_URI . '/css/extra.min.css',
[],
BISTEINOFF_VERSION
);
} );Runtime constants (do not define these yourself)
The theme sets these during the request after the query is known. Treat them as read-only.
| Constant | When it exists | Meaning |
|---|---|---|
BISTEINOFF_PAGE_TYPE |
After the wp action on the front end, and on post/term screens in admin |
Sanitized slug of the current view, used by SEO, breadcrumbs, and body classes. Examples: frontpage, page, post, blog, contact, product, shop, search, error404, maintenance, or a custom post type / taxonomy slug. |
BISTEINOFF_LANG_SLUG |
When multilingual mode is on and a secondary language is active | Current language slug (empty on the primary language). |
Typical use in a child theme:
add_action( 'wp', function () {
if ( ! defined( 'BISTEINOFF_PAGE_TYPE' ) ) {
return;
}
if ( 'contact' === BISTEINOFF_PAGE_TYPE ) {
add_filter( 'body_class', function ( $classes ) {
$classes[] = 'is-contact-page';
return $classes;
} );
}
} );Deprecated constants
Do not add these to new projects. If they are still in an old wp-config.php, remove them and use the replacements.
| Constant | Status | Replacement |
|---|---|---|
BISTEINOFF_THEME_OPTIONS_COLORS |
Deprecated since 2.6.0. Triggers _doing_it_wrong(). |
Define BISTEINOFF_THEME_DESIGN_COLORS and BISTEINOFF_THEME_DESIGN_GRADIENTS separately. |
BISTEINOFF_USE_DESVG |
Deprecated since 2.6.0. Default false. |
Use Design Settings → Configuration (inline SVG option) instead. |
Quick checklist
- Put site-wide flags in the child
functions.php(top of the file) or inwp-config.php. - Never define a constant after the parent theme has loaded.
- Do not redefine
BISTEINOFF_MIN_PHP,BISTEINOFF_MIN_WP,BISTEINOFF_PAGE_TYPE, orBISTEINOFF_LANG_SLUG. - When extending CSP, copy the default whitelist and append your origins.
- For output and data (extra markup, custom SEO tags, extra social networks), use theme hooks.