Disable Genesis Extender Default Stylesheet

Prevent the default stylesheets from loading when using Dynamik or Genesis Extender.

Using Dynamik Website Builder

The experiment: Styling the Dynamik child theme using Sass, Bourbon/Bitters/Neat, and Codekit. The plan is to paste the final minified CSS output from Codekit into the custom CSS box in Dynamik.

The problem: Dynamik automatically loads Dynamik and Genesis default styles. I don’t want to use any of these styles and don’t want to waste HTTP requests loading unused stylesheets.

The solution: Jason Seabolt at Cobalt Apps got me started and turned me on to the idea of dequeuing the style sheets. After some experimentation, here’s the code that worked:

Place this code at the bottom of your Dynamik Custom Functions

remove_action( 'genesis_meta', 'dynamik_add_stylesheets' );
add_action( 'wp_enqueue_scripts', 'remove_default_stylesheet', 25 );
function remove_default_stylesheet() {
    wp_dequeue_style( 'dynamik_design_stylesheet' );
    wp_deregister_style( 'dynamik_design_stylesheet' );
    wp_dequeue_style( 'dynamik_genesis_stylesheet' );
    wp_deregister_style( 'dynamik_genesis_stylesheet' );
}

When Using Genesis Extender

A similar issue happens when using the Genesis Extender Plugin. Since all your styles are created by Sass using Codekit and your Sass library, there’s no need to load this empty stylesheet.

Place this code at the bottom of your theme functions.php

remove_action( 'genesis_meta', 'genesis_extender_load_stylesheets' );
add_action( 'wp_enqueue_scripts', 'remove_default_stylesheet', 25 );
function remove_default_stylesheet() {
    wp_dequeue_style( 'genesis_extender_add_stylesheets' );
    wp_deregister_style( 'genesis_extender_add_stylesheets' );
    wp_dequeue_style( 'genesis-extender-minified' );
    wp_deregister_style( 'genesis-extender-minified' );
}

Sources: wpsites.net, chriswiegman.com.

Hire a WordPress Expert

Get hourly and project based theme customization, theme tweaks, and development help from world-class WordPress developers at Codeable. If you’re in Kelowna and need a custom website for your business visit our Kelowna Web Design page now to get started.