0

I am adding menu items with the code below, the menu items show up when clicked but they give damaged url's

e.g for the top link when clicked

http://timothylhanson.com/bp/%3C?php%20return%20bp_loggedin_user_domain()%20?%3Eactivity/just-me/

clearly this

<?php return bp_loggedin_user_domain() ?>

is not being returned properly

Any help with this is greatly appreciated Thanks

function add_profile_link_to_nav($items) {
    if ( is_user_logged_in() )

return $items . 
 '<li class="myclass"><a href="<?php return bp_loggedin_user_domain() ?>activity/just-me/">My Wall</a>

<ul class="sub-menu">

 <li class="menu-item"><a href="<?php return bp_loggedin_user_domain() ?>activity/friends/">My Friends Activities</a></li>
 <li class="menu-item"> <a href="<?php return bp_loggedin_user_domain() ?>profile/edit/group/1">Edit My Profile</a></li>

</ul>
 </li>';
}
add_filter('wp_nav_menu_items','add_profile_link_to_nav', 10, 2); 
0

Your <?php return bp_loggedin_user_domain() ?> is part of a string therefor it is not executed. You should probably have

'<li class="myclass"><a href="'. bp_loggedin_user_domain() .'activity/just-me/">My Wall</a> ...
  • Thank you, that was the problem, very grateful for your help. – xyz Jan 11 '13 at 0:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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