Managing Framework Features (Bloat Control)

Your Theme Blvd themes comes with a ton of end-user features, that you may or may not need, depending on how (and for who) you’re setting up your website. So, one of my personal favorite features of the theme framework is the global configuration filter because it gives developers a chance to cut out extra bloat, they feel isn’t needed.

About the Global Configuration

The global configuration is just a categorized (nested) array of items that the framework looks to for a true or false, before implementing many features. And this array has a filter themeblvd_global_config applied that allows you to easily modify it from your child theme.

This is really useful because it allows you to disable many features from just one place, without having to search around for exactly how to disable them.

For example, let’s say you wanted to completely disable Bootstrap from running in the framework. Instead of hunting around for all traces of Bootstrap, you’d simply use the global configuration filter, which will automatically (1) de-enqueue the Bootstrap stylesheet, (2) de-enqueue our custom Bootstrap grid-extension stylesheet, (3) de-enqueue the Bootstrap JavaScript file, and (4) prevent any related custom JavaScript from running in the framework’s themeblvd.js file.

Global Configuration Reference

Below is a reference the available features that can be enabled or disabled.

Category Feature Description
admin options Whether theme options admin interface runs.
builder Whether layout builder admin interface runs (with Layout Builder plugin).
sidebars Whether widget area admin interface runs (with Widget Areas plugin).
updates Whether in-dashboard update system is included.
user Whether options are added to user profiles.
tax Whether options are added to Edit Category and Edit Tag admin pages.
menus Whether options are added to Appearance > Menus screen (for setting up mega menus).
base Whether theme bases are supported.
meta page_options Whether Page Options meta box is added.
post_options Whether Post Options meta box is added.
pto Whether Post Template Options meta box is added.
layout Whether Theme Layout meta box is added.
comments posts Whether comments presence is supported for Posts.
pages Whether comments presence is supported for Pages.
attachments Whether comments presence is supported for Attachments.
display sticky Whether to sticky header is supported.
mobile_panel Whether responsive mobile menu is constructed and implemented.
side_panel Whether desktop side panel is implemented with Side Navigation menu locations.
scroll_effects Whether animations are used for elements to appear when scrolling down custom layout pages.
hide_top Whether the end-user hiding the header on pages and posts is supported.
hide_bottom Whether the end-user hiding the footer on pages and posts is supported.
footer_sync Whether syncing footer with layout builder template from theme options is supported.
suck_up Whether the end-user selecting a Transparent Header on pages and posts is supported.
gallery Whether the framework customizes WordPress [gallery].
print Whether to apply basic styles for printing.
assets primary_js Whether themeblvd.js script gets included.
primary_css Whether themeblvd.css stylesheet gets included.
flexslider Whether Flexslider script gets included.
bootstrap Whether Twitter Bootstrap assets get included and implemented.
fontawesome Whether FontAwesome get included and implemented.
magnific_popup Whether Magnific Popup assets get included and implemented.
superfish Whether Superfish assets get included and implemented.
easypiechart Whether EasyPieChart script gets included.
gmap Whether Google Maps script (API v3) gets included.
charts Whether Charts.js script gets included.
isotope Whether Isotope script for jQuery sorting gets included.
tag_cloud Whether custom styling for WordPress tag cloud gets applied.
owl_carousel Whether Owl Carousel assets get included.
in_footer Whether all theme scripts are enqueued in footer.
plugins bbpress Whether theme customizations are applied, when using bbPress plugin.
gravityforms Whether theme customizations are applied, when using Gravity Forms plugin.
subtitles Whether theme customizations are applied, when using Subtitles plugin.
woocommerce Whether theme customizations are applied, when using WooCommerce plugin.
wpml Whether theme customizations are applied, when using WPML plugin.
Note: The above table applies to Theme Blvd Framework 2.7+. If you’re looking for the exact global configuration array in your theme version, find the themeblvd_setup() function in your theme.

How to Edit the Global Configuration

When editing the global configuration array, you’re just filtering one big, nested array that contains all the items referenced in the table above. For any feature you want to enable/disable, you’ll need to the category and feature IDs referenced.

You’ll filter the array using themeblvd_global_config. Here would be your basic setup for that, from your child theme’s functions.php.

/**
 * All edits to global configuration.
 */
function my_global_config( $config ) {

	// Make edits to $config ...

	return $config;
}
add_filter('themeblvd_global_config', 'my_global_config');

Following what we’ve started setting up above, we can target items in the $config array, utilizing the category and feature IDs like $config['foo']['bar']. And then you’ll be setting those values to true or false.

Below is our basic setup, expanded to include several examples. In these examples, I’m just pulling category and feature IDs from the reference table above.

/**
 * All edits to global configuration.
 */
function my_global_config( $config ) {

	// Remove meta boxes.
	$setup['meta']['page_options'] = false;
	$setup['meta']['post_options'] = false;

	// Disable sticky menu.
	$config['display']['sticky'] = false;

	// Add comments to pages.
	$config['comments']['pages'] = true;

	// Remove unused assets.
	$config['assets']['flexslider'] = false;
	$config['assets']['owl_carousel'] = false;
	$config['assets']['superfish'] = false;
	$config['assets']['easypiechart'] = false;
	$config['assets']['isotope'] = false;

	return $config;

}
add_filter( 'themeblvd_global_config', 'my_global_config' );