Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This is what I am using for bp profile links on navi menu bar.

    // Filter wp_nav_menu() to add profile link
    add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
    function my_nav_menu_profile_link($menu) {  
        if (!is_user_logged_in())
            return $menu;
        else
            $profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '">' . __('My Profile') . '</a></li>';
            $menu = $menu . $profilelink;
            return $menu;
    }

I need to add "Join Us" when you are not login. so I added like this

    // Filter wp_nav_menu() to add profile link
    add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
    function my_nav_menu_profile_link($menu) {  
        if (!is_user_logged_in())
            $joinlink = '<li><a href="' . wp_register() . '">' . __('Register') . '</a></li>';
            $menu = $menu . $joinlink;
            return $menu;
        else
            $profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '">' . __('My Profile') . '</a></li>';
            $menu = $menu . $profilelink;
            return $menu;
    }

But it's an error. how I can fix it to work? Thanks all the time.

share|improve this question
    
I put wrong codes :) and fixed right one. please let me know how I can add "register" if you have any idea. –  pulla Jul 15 '13 at 3:33

1 Answer 1

Instead of :

$joinlink = '<li><a href="' . wp_register() . '">' . __('Register') . '</a></li>';

Try :

$joinlink = '<li>' . wp_register('', '', false) . '</li>';

You can check wp_register function documentation to get a better idea

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.