Archived topic
Setting sidebar for BuddyPress/bbPress/Woocommerce
5 replies · Started by Oleg on February 22, 2016
Some premium themes you can customize the layout of the left/right/not sidebaer, not only for the blog/page, but also for WooCommerce, BuddyPress, bbPress. Can I do this with GeneratePress?
Yes, you can use this filter: https://generatepress.com/knowledgebase/choosing-sidebar-layouts/#sidebar-filter
For example:
WooCommerce
add_filter( 'generate_sidebar_layout','generate_custom_woocommerce_sidebar_layout' );
function generate_custom_woocommerce_sidebar_layout( $layout )
{
// If we are on a woocommerce page, set the sidebar
if ( is_woocommerce() )
return 'both-left';
// Or else, set the regular layout
return $layout;
}
BuddyPress
add_filter( 'generate_sidebar_layout','generate_custom_buddypress_sidebar_layout' );
function generate_custom_buddypress_sidebar_layout( $layout )
{
// If we are on a buddypress page, set the sidebar
if ( is_buddypress() )
return 'both-left';
// Or else, set the regular layout
return $layout;
}
bbPress:
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 'both-left';
// Or else, set the regular layout
return $layout;
}
Thank you! I can not help wondering how your theme is flexible and convenient. It is much more complicated than it seems at first glance.
It would be nice to have all these options in the customizer but things would get very messy/overwhelming.
Having these filters and hooks everywhere at least makes it so basically anything is possible :)
I think your theme somewhere between Genesis and Avada :)
Not a bad place to be! :)
