add register button to the main menu
-
Hy. An old question.
I have a code for login/logout in my functions.php and in works perfectly.
Now, I need to provide a Register link for non logged’in and for logged in for free (I have an s2member plugin and it would be a membership page with register options).where do I need to put it inside my main code? what should I add?
My code is:add_filter( 'wp_nav_menu_items', 'wti_loginout_menu_link', 10, 2 ); function wti_loginout_menu_link( $items, $args ) { if ($args->theme_location == 'ast-menu-primary') { if (is_user_logged_in()) { $items .= '<li><a href="http://salivary.ilpatologo.com/getinside/?action=logout&_wpnonce=09895867b7">Log Out</a></li>'; } else { $items .= '<li><a href="http://salivary.ilpatologo.com/getinside/">Log In</a></li>'; } } return $items; }
Also, need to add a line of code to show username when logged in.
my website is:
salivary.ilpatologo.comthanks
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘add register button to the main menu’ is closed to new replies.