Return to Snippet

Revision: 39183
at January 14, 2011 06:25 by labsecrets


Updated Code
// Filter to add new myprofile link to nav menu

function new_nav_menu_items($items) {
	$profilelink = '<li id="my-profile" class="my-profile"><a  href="' . bp_loggedin_user_domain() . '"> MyProfile</a></li>';
	$items = $items . $profilelink;
	return $items;
}
add_filter( 'wp_list_pages', 'new_nav_menu_items' );
add_filter( 'wp_nav_menu_items', 'new_nav_menu_items' );


// Create Member Profile link with shortcode in pages and posts

function member_profile( $atts, $label = null ) { 
echo '' . $label . ''; 
}
add_shortcode('member_profile', 'member_profile');



Next, add the following to your style.css in order to float the new profile link to the right and add some font color and weight:


li#my-profile.my-profile { 
float:right; 
}

li#my-profile.my-profile a {
font-weight:bold;
color:red;
}

Revision: 39182
at January 14, 2011 06:23 by labsecrets


Initial Code
// Filter to add new myprofile link to nav menu

function new_nav_menu_items($items) {
	$profilelink = '<li id="my-profile" class="my-profile"><a  href="' . bp_loggedin_user_domain() . '"> MyProfile</a></li>';
	$items = $items . $profilelink;
	return $items;
}
add_filter( 'wp_list_pages', 'new_nav_menu_items' );
add_filter( 'wp_nav_menu_items', 'new_nav_menu_items' );


// Create Member Profile link with shortcode in pages and posts

function member_profile( $atts, $label = null ) { 
echo '' . $label . ''; 
}
add_shortcode('member_profile', 'member_profile');
</code></pre>



Then, add the following to your style.css in order to float the new profile link to the right:
<pre><code>
li#my-profile.my-profile { 
float:right; 
}
li#my-profile.my-profile a {
font-weight:bold;
color:red;
}

Initial URL


Initial Description


Initial Title
Add Member Links and ShortCode

Initial Tags


Initial Language
HTML