Leo
(@leohsiang)
Hi there,
The Membership page isn’t working because it’s an auto-generated page from BuddyPress so the metabox is ignored by default.
Can you give this PHP snippet a shot?
add_filter( 'generate_sidebar_layout', function( $layout ) {
// If we are on a category, set the sidebar
if ( is_page( 17 ) ) {
return 'right-sidebar';
}
// Or else, set the regular layout
return $layout;
} );
Adding PHP: https://docs.generatepress.com/article/adding-php/
Hello Leo,
Thank you, the php code works well for the “BP Member” page … We have a function.php file and your Child Theme ….
Please what is the code for the “BP Profile” and “BP Register” pages with a RIGHT sidebar like the “BP Member” pages ?
For information :
We have a Theme which is very popular but slow down our site …
We wish to replace it by GeneratePress Theme because your Theme is lightweight and great for speed …
Our site has 2 main plugins :
– BuddyPress plugin with one “Member” Advanced Search Widget in the RIGHT Sidebar
– One Classified Ads plugin with one “Listing” Advanced Search Widget in the LEFT Sidebar
The Sidebar Layout of these 2 plugins is forced by the Site Wide Sidebar Layout settings in the Customizer … and we cannot set a particular Sidebar Layout for each pages and posts … Your PHP code should help …
I have just updated the “Tags” of this message by “GeneratePress BuddyPress Sidebars” and I hope that it can help Search Engine and other users of your Theme ….
Thanks in advance,
Chris
Theme Author
Tom
(@edge22)
Hi there,
What if you do this?:
add_filter( 'generate_sidebar_layout', function( $layout ) {
if ( function_exists( 'is_buddypress' ) && is_buddypress() ) {
return 'right-sidebar';
}
// Or else, set the regular layout
return $layout;
} );
Let me know 🙂
Hello Tom,
Thank you very much for your code … It works great for BuddyPress Sidebars
For information. I have pasted the code in the function.php file of the Child Theme …
Due to one outdated BP extension, we use the BP “Legacy” Template instead of the BP “Nouveau” Template. Anyway, your theme improve the layout …
I recommend your GeneratePress theme for BuddyPress plugin with the updated BP “Nouveau” Template because it’s really handsome … Moreover, your GeneratePress Theme loads fast on mobiles when we install Cache/image optimization plugins and use CDN … GTMetrix shows good results too …
For information, we use mainly lightweight plugins even for Security … no e-commerce, no translation, no …. that might help to improve the speed too …
Anyway, I just add links for other BP users :
https://docs.generatepress.com/collection/sidebars/
https://docs.generatepress.com/article/sidebar-layout/
left-sidebar
right-sidebar
no-sidebar
both-sidebars
both-left
both-right
Thank you & Best Regards,
Chris
Theme Author
Tom
(@edge22)
Thanks, Chris! Glad you’re enjoying GP 🙂