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. 😉
Search

Popular Posts

Small Biz Website Tips Newsletter

Stay up to date with the latest marketing, sales, and service tips and news.

Small Biz Website Tips Newsletter

Stay up to date with the latest marketing, sales, and service tips and news.