No sidebars on bbPress and buddyPress pages

Home Forums Support No sidebars on bbPress and buddyPress pages

Home Forums Support No sidebars on bbPress and buddyPress pages

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #152975
    Paul

    Hey guys.

    I’m using buddyPress and bbPress with GeneratePress, and it works pretty well out of the box. However, I don’t understand why the sidebar configuration options don’t apply to the pages associated with Members and Activity. The GeneratePress page.php template is being used, and I even copied that template to my child theme, renaming to buddypress.php, and it makes no difference. No matter what sidebar options I configure on those pages in the WP page editor, it always shows a right sidebar… which I suspect is being picked-up from the layout defaults in GeneratePress.

    Anyway, would love it if you could explain why they might not work, Tom? I know they are plug-ins, but I’m sure you’d also like to be able to have GeneratePress control the sidebar layout for these plugin pages?

    Anyway, in the mean time, if I can’t control them through the WP page editor, I need to hide them.

    So I thought I’d share my clean way of doing that for others that want to achieve the same thing:

    Just add the following to your theme’s functions.php file or site plugin.

    function bbPress_buddyPress_no_sidebar( $layout )
    {
     	if ( is_bbpress() || bp_is_activity_front_page() || bp_is_directory() || bp_is_home() )
     	 	return 'no-sidebar';
    
     	return $layout;
    
    }
    add_filter( 'generate_sidebar_layout','bbPress_buddyPress_no_sidebar' );
    #153034
    Tom
    Lead Developer
    Lead Developer

    Hi Paul,

    WordPress sees these pages as blog pages using the index.php file, so the “Blog Sidebar Layout” in the Customizer controls the sidebar for them.

    It’s the same with any custom post type like WooCommerce etc..

    I could create options for these plugins, and do plan on doing so for WooCommerce, but sooner or later we’ll have so many sidebar layout options it will be too much.

    The function you shared is perfect – any reason why you don’t use it to display your preferred sidebar layout on those pages?

    #153037
    Paul

    Hey Tom.

    WordPress sees these pages as blog pages using the index.php file, so the “Blog Sidebar Layout” in the Customizer controls the sidebar for them.

    So that’s the default, right? As in, use the default blog page sidebar layout for these plug-in pages.

    However, I still don’t know why I can’t override the layout of a specific page using the per page settings you provide. E.g. I have a Members page, which is targeted/linked to the buddyPress Members page. When I edit that page and set the side bars to Content (no sidebars), it does not change the page layout. That’s the part I don’t understand… it would be useful if it did.

    …any reason why you don’t use it to display your preferred sidebar layout on those pages?

    None really. Although I wasn’t sure how to have different sidebar content for a specific page. Jetpack allows some level control here, allowing you to set visibility of widgets for certain meta values, but not sure that would work here.

    Hiding is good enough for now, but I would love to do it through the page editor settings, not code.

    #153144
    Tom
    Lead Developer
    Lead Developer

    The per-page settings won’t work for the same reason they don’t work for the blog index when it’s set to a page – WordPress ignores all metabox entries for these post types that are using the index.php template.

    When you’re using a shortcode to display your content, the metabox values will work, but when it’s the plugin applying the functionality to the page, they won’t.

    Unfortunately it’s just a WordPress thing at this point.

    Let me know if you need more info 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.