Cyber Week Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

Reply To: Enable sidebar in BBpress topics and disable them in WP single post

Home Forums Support Enable sidebar in BBpress topics and disable them in WP single post Reply To: Enable sidebar in BBpress topics and disable them in WP single post

#183335
Tom
Lead Developer
Lead Developer

Hi there,

You can do something like this:

add_filter( 'generate_sidebar_layout','generate_custom_bbpress_sidebar_layout' );
function generate_custom_bbpress_sidebar_layout( $layout )
{
 	// If we are on a bbpress page, set the sidebar
 	if ( is_bbpress() )
 	 	return 'right-sidebar';

 	// Or else, set the regular layout
 	return $layout;

 }

Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/