Forum Replies Created
-
AuthorPosts
-
cyndimarieMember
Hi Brad
I know I can use loginout for the links. The code I posted above I had simplified to just show the text. Here's the actual code:
// Filter wp_nav_menu() to add loginout link and register/my profile link
add_filter( 'genesis_nav_items', 'my_loginout' );
add_filter( 'wp_nav_menu_items', 'my_loginout' );
function my_loginout($menu) {
if (!is_user_logged_in()) {
$outlink = '<li class="custom-menu-item">' . __('Login') . '';
$joinlink = '<li class="custom-menu-item">' . __('Register') . '';
$menu = $menu . $joinlink . $outlink;
return $menu;
} else
$inlink = '<li class="custom-menu-item">' . __('Logout') . '';
$profilelink = '<li class="custom-menu-item">' . __('My Profile') . '';
$menu = $menu . $profilelink . $inlink;
return $menu;
}
I prefer to do it this way so I can customize the links further.
My real issue here is making it only show up on the secondary nav. Any idea how to do that?
cyndimarieMemberHi Brad
I know I can use loginout for the links. The code I posted above I had simplified to just show the text. Here's the actual code:
add_filter( 'genesis_nav_items', 'my_loginout' ); add_filter( 'wp_nav_menu_items', 'my_loginout' ); function my_loginout($menu) { if (!is_user_logged_in()) { $outlink = '<li class="custom-menu-item"><a href="/sign-in">' . __('Login') . '</a></li>'; $joinlink = '<li class="custom-menu-item"><a href="/register">' . __('Register') . '</a></li>'; $menu = $menu . $joinlink . $outlink; return $menu; } else $inlink = '<li class="custom-menu-item"><a href="'.wp_logout_url().'" >' . __('Logout') . '</a></li>'; $profilelink = '<li class="custom-menu-item"><a href="' . bp_loggedin_user_domain( '/' ) . '">' . __('My Profile') . '</a></li>'; $menu = $menu . $profilelink . $inlink; return $menu; }
I prefer to do it this way so I can customize the links further.
My real issue here is making it only show up on the secondary nav. Any idea how to do that?
-
AuthorPosts