Site logo

Archived topic

Page unaffected to all methods of removing sidebar

3 replies · Started by Carsten on March 17, 2023

Viewing posts 1–4 of 4

Hi there, I want to have no sidebar on my BuddyPress register page, so members content is not exposed for logged out users.

The Layout of the page is set to No sidebars, and I even added this code to remove the sidebar, but nothing helps, the sidebar is still there. The id is correct, and I have also tried the page slug 'register' as well.

Why is this page alone totally unaffected to all methods?

Regards
Carsten

 add_filter( 'generate_sidebar_layout', function( $layout ) {
     
    if ( is_page(34311) ) {
        return 'no-sidebar';
    }
       // Or else, set the regular layout
    return $layout;
 } ); 
	

Hi there,

try:


 add_filter( 'generate_sidebar_layout', function( $layout ) {
     
    if ( bp_is_register_page() ) {
        return 'no-sidebar';
    }
       // Or else, set the regular layout
    return $layout;
 } ); 

Hi there, thanks a lot for the snippet, finally the sidebar is gone from the page. But I wonder why the ID did not work on that page?

Because BuddyPress swaps it out for its own template :)

Glad to hear its working.

This archived topic is closed to new replies.