Clean Slate

Seth Carstens edited this page Nov 1, 2016 · 1 revision

Clean Slate

##Clear Header and Content Header

Whitelabel sure has a lot of “crap” that gets loaded for being a skeleton theme… yes we agree, but we did want to show some basic functionality and use of the layouts you can select. We understand that can be frustrating, and as such we have created the following code, which you can copy and paste into your child theme’s functions.php file, it will wipe all the HTML -> Header tag content (title, meta, styles and scripts) as well as removing the default Content Header, which has the logo, aside widget, nav, and breadcrumbs.

$action_removes = ['build_theme_head', 'body_enqueue', 'build_theme_header', 'build_theme_breadcrumbs'];
foreach($action_removes as $a) {
  remove_all_actions($a);
}
remove_action('wp_enqueue_scripts', 'setup_scripts_and_styles_enqueue', 20);
remove_action('wp_print_styles', 'load_theme_stylesheet_last', 99);
add_action('build_theme_head', 'wp_head');
//sm_disable_admin_bar();//uncomment to also remove admin bar

Make sure its at the top of your file, and then anything you add/enqueue etc after that will load on your new “blank slate”. This is as “White Label” as it gets.

*Note this is also very useful in page templates, if you want to completely change the look/feel of the page. One example might be a page that’s a fullscreen google map. You would want to wipe the headers, enqueue just your map scripts and style the container DIV to be 100% height.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.