Add login/register to nav menu? Help please
-
Hi guys I to implement a register/login in the menu. I edited functions.php and I added the following code:
add_action('wp_head', 'cg_loves_ipad'); add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2); function add_login_logout_link($items, $args) { ob_start(); wp_loginout('index.php'); $loginoutlink = ob_get_contents(); ob_end_clean(); $items .= '<li>'. $loginoutlink .'</li>'; return $items; } add_filter('wp_nav_menu_items', 'add_register_link', 10, 2); function add_register_link($items, $args) { ob_start(); wp_register(''); $registerlink = ob_get_contents(); ob_end_clean(); $items .= '<li>'. $registerlink .'</li>'; return $items; }
The problem is that all logged in users appear as the site administrator instead of putting his nick. Someone help me modify the code? Do not know much about php.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Add login/register to nav menu? Help please’ is closed to new replies.