Override the Default bbPress Stylesheet

After installing bbPress back onto my theme site, I realized the default stylesheet was pretty bloated. At first, I started abusing the important declaration in my own stylesheet, but then I thought there must be a better way.
With a bit of sleuthing, I uncovered a filter used by bbPress to set up the default stylesheets. With a short function I managed to override them with my own.
I placed this in my functions.php file:

add_filter( 'bbp_default_styles', 'bavotasan_custom_bbpress_css' );
/**
 * Remove bbPress stylesheet
 *
 * This function is attached to the 'bbp_default_styles' filter hook.
 *
 * @since 3.1
 */
function bavotasan_custom_bbpress_css( $styles ) {
	$styles['bbp-default']['file'] = get_template_directory_uri() . '/bbpress.css';
	return $styles;
}

Then I copied over all the default CSS from the original bbPress stylesheet and pasted it into a file in my theme directory called bbpress.css. With all that in place, I was able to slash away at the unneeded CSS.
Next up, I might try to create a SASS version of the default bbPress stylesheet. But don’t hold your breath just yet. 😉

Share this:

Email
Facebook
Twitter
Pinterest
Pocket

Premium Themes for WordPress

Looking for an easy-to-use Premium Theme for WordPress? Check out Themes by bavotasan.com and have your site up and running in no time.

Use this WordPress website builder to build powerful websites in no time for your or your clients.

WordPress Hosting

WP Engine – designed from the ground-up to support and enhance the workflow of web designers.

Bluehost – providing quality web hosting solutions since 1996.

About the author

Picture of Luke Perrie

Luke Perrie