Skip to:
Content
Pages
Categories
Search
Top
Bottom

BuddyPress Profile Link

  • Avatar of jbt103
    jbt103
    Participant

    @jbt103

    I want to create a “My Profile” link in one of my menus and I found the following code:

    `// Filter wp_nav_menu() to add profile link
    add_filter( ‘wp_nav_menu_items’, ‘my_nav_menu_profile_link’ );
    function mme_nav_menu_profile_link($menu, $args) {
    $profilelink = ‘‘ . __(‘My Profile’, ‘buddypress’ ) . ‘;
    if (is_user_logged_in() && ‘usernav’ == $args->theme_location )
    return $profilelink . $menu;
    else
    return $menu;
    }
    add_filter( ‘wp_nav_menu_items’, ‘mme_nav_menu_profile_link’, 10, 2);`

    I got a reply on WordPress Support but it gave me a blank screen and this person has given me a lot of help, I almost hate to keep asking but it still isn’t working. So I’m trying over here instead.

    The last code this person gave me was:
    `// Filter wp_nav_menu() to add profile link
    add_filter( ‘wp_nav_menu_items’, ‘mme_nav_menu_profile_links’, 10, 2 );
    function mme_nav_menu_profile_link($menu, $args) {
    if( is_user_logged_in() && $args->theme_location == ‘usernav’ ){
    $profilelink = ‘

  • ‘ . __(‘My Profile’) . ‘
  • ‘;
    $menu = $profilelink . $menu;
    }
    return $menu;
    }`

    That didn’t give me a white screen but all my menu’s disappeared.

    My site is JoshuaTrent.com and the menu I’m wanting the BuddyPress link for is ‘usernav’ it’s on the top next to the search bar. It’s only shown when members are logged in, otherwise ‘visitornav’ is shown.

You must be logged in to reply to this topic.