How to make Patch work with bbPress
By default, the way we designed the theme does not allow for the bbPress plugin to work to its full capabilities.
But have no worries, there’s a simple fix that can ensure you can use both products with ease.
Here’s what you need to do:
- First off, make sure you install the Patch Child theme. This ensures that all of the extra code you need won’t be removed when we release a new theme update.
- Navigate to Appearance → Theme Editor → make sure the Patch Child theme is selected
- Click the functions.php file → scroll to the bottom of the screen (in the code editor) → and paste the code below:
/*Fix integration with BBPress*/
function alter_post_classes( $classes ) {
if ( function_exists( 'is_bbpress' ) && is_bbpress() ) {
if ( ( $key = array_search( 'entry-card js-masonry-item', $classes ) ) !== false ) {
unset( $classes[ $key ] );
}
}
return $classes;
}
add_filter( 'post_class', 'alter_post_classes', 20 );
function alter_body_class( $classes ) {
if ( function_exists( 'is_bbpress' ) && is_bbpress() ) {
if ( ( $key = array_search( 'archive', $classes ) ) !== false ) {
unset( $classes[ $key ] );
$classes[] = 'page';
}
}
return $classes;
}
add_filter( 'body_class', 'alter_body_class', 999 );
- Click Update file and that’s it.
Here’s a helpful image:
Updated on February 9, 2022