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.

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); 
share|improve this question

1 Answer 1

up vote 0 down vote accepted

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> ...
share|improve this answer
    
Thank you, that was the problem, very grateful for your help. –  Tim Jan 11 '13 at 0:16

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.