Statistics: Posted by Cristián Lávaque — August 6th, 2011, 12:24 am
register_nav_menus(
array(
'main-menu' => __( 'Main Menu' ),
'top-menu' => __( 'Top Menu' )
<?php
// Filter wp_nav_menu() to add links or text
function new_nav_menu_items($items,$args)
{
if( $args->theme_location == 'top-menu' ) //if we have the top menu which is the registered menu name in my theme
{
if (is_user_logged_in())
{
if (current_user_can("access_s2member_level2")) // content for Members who are logged in with an s2Member Level >= 2.
{
$homelink2 = '<li class="home"><a href="http://mydomain.com/wp1/the-page-to-link-to/" >The link name</a></li>'.'<li class="home"><a href="http://mydomain.com/wp1/the-page-to-link-to/" >The link name</a></li>'.;
$items = $homelink2 . $items;
}
$homelink = '<li class="home"><a href="http://mydomain.com/wp1/wp-login.php?action=logout" >Logout</a></li>'.'<li class="home"><a href="http://mydomain.com/wp1/profile-page" >My Profile</a></li>';
$items = $homelink . $items;
}
else
{
$homelink = '<li class="home"><a href="http://mydomain.com/wp1/wp-login.php" >Login/register</a></li>';
$items = $homelink . $items;
}
}
return $items;
}
add_filter( 'wp_nav_menu_items', 'new_nav_menu_items',10,2);
?>
Statistics: Posted by man-O-media — August 4th, 2011, 1:37 pm