Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Remove ’home’ from menu without using custom menu


  • notpoppy
    Participant

    @notpoppy

    I’m building a theme based on the Buddypress default theme.

    I would like to remove the ‘Home’ button from the navigation menu which is created using wp_nav_menu.

    I understand one way to do this is to replace the menu with a custom menu. However I would rather not use this solution as it would require me to manually build the entire menu on a site with a large and complicated page structure and alter it when I add or remove pages.

    The menus created using wp_nav_menu automatically reflect any changes in the hierarchy, which would be a preferable solution.

    I found a technique for removing the ‘Home’ button described here using this code in functions.php:

    `function page_menu_args( $args ) {
    $args = FALSE;
    return $args;
    }
    add_filter( ‘wp_page_menu_args’, ‘page_menu_args’ );`

    I have been unable to get this code to work although it seems others have had succes with it.

    I wonder if this is because of the additional arguments added to the menu through the Buddypress theme which calls the menu using this argument in header.php:

    `’fallback_cb’ => ‘bp_dtheme_main_nav’`

    And adds the following in the default functions.php:

    `function bp_dtheme_main_nav( $args ) {
    global $bp;
    $pages_args = array(
    ‘depth’ => 0,
    ‘echo’ => false,
    ‘exclude’ => ”,
    ‘title_li’ => ”
    );
    $menu = wp_page_menu( $pages_args );
    $menu = str_replace( array( ‘

    ‘ ), array( ‘

    ‘ ), $menu );
    echo $menu;
    do_action( ‘bp_nav_items’ );
    }
    endif;
    if ( !function_exists( ‘bp_dtheme_page_menu_args’ ) ) :`

    Can anyone suggest a solution to this?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Remove ’home’ from menu without using custom menu’ is closed to new replies.
Skip to toolbar