Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hiding the BuddyPress menu on specific BP pages


  • Chris Liu-Beers
    Participant

    @tomatillo

    I’d like to hide the entire BP menu (Profile, Notifications, etc.) and just show the BP content on a couple BP pages (such as Followers and Following). Is this possible? Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)

  • Henry Wright
    Moderator

    @henrywright

    Hi @tomatillo

    It’s definitely possible. Actually, there’s probably many ways to do it.

    Try adding this to your theme’s functions.php file:

    function my_custom_bp_nav_menu( $args ) {
        if ( bp_is_current_action( 'following' ) || bp_is_current_action( 'followers' ) )
            $args['echo'] = false;
    
        return $args;
    }
    add_filter( 'bp_nav_menu_args', 'my_custom_bp_nav_menu' );

    Note: I haven’t tested.


    Chris Liu-Beers
    Participant

    @tomatillo

    Thanks for the quick reply. However this didn’t seem to work for me. I’m still learning BP. Could you explain how this works or post another snippet? Very much appreciated.


    Henry Wright
    Moderator

    @henrywright

    I’m using the bp_nav_menu_args filter hook to modify the args sent to bp_nav_menu(). The code assumes you’re using bp_nav_menu() to display your navigation menu. By changing the value of $args['echo'] to false, a string containing the nav menu markup is returned (i.e. not echo’d to screen).

    The 2nd line is just a conditional to govern which pages the filter function applies to.

    I didn’t get the chance to test it myself. Can you provide more info on how it isn’t working?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hiding the BuddyPress menu on specific BP pages’ is closed to new replies.
Skip to toolbar