This topic contains 3 replies, has 2 voices, and was last updated by
Wes 3 years, 1 month ago.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.
Premium WordPress Themes for The Genesis Framework
Home › Community Forums › Vintage Theme Support › Log in/Register in Menu
Tagged: menu
This topic contains 3 replies, has 2 voices, and was last updated by
Wes 3 years, 1 month ago.
Hello
Is there an easy way to put the login/register meta in the secondary navigation menu? Not versed in PHP but willing to try… Thanks. And what anti-spam plugins would you recommend? Is captcha good enough?
Try this code in your functions.php file –
add_filter( 'wp_nav_menu_items', 'sp_add_loginout_link', 10, 2 );
function sp_add_loginout_link( $items, $args ) {
// Change 'primary' to 'secondary' to put the login link in your secondary nav bar
if ( $args->theme_location != 'primary' )
return $items;
if ( is_user_logged_in() ) {
$items .= '<li class="menu-item"><a href="'. wp_logout_url() .'">Log Out</a></li>';
} else {
$items .= '<li class="menu-item"><a href="'. site_url('wp-login.php') .'">Log In</a></li>';
}
return $items;
}
This works for the Primary Menu so you’ll have to make adjustments to the code in order for it to work with the Secondary Menu.
Source – https://gist.github.com/nickcernis/02086c75ee9aa19447e0
I tested on a regular Primary Menu and it worked perfectly for “Logged in” and “Out” users. You can test to see if your adjustments work for the Secondary Menus as well.
Currently, I’m not using any Anti Spam plugins so I’m not sure which one would be best at the moment. I’d check the reviews to see what other users are prefer.
Thanks! That worked out nicely… Do you know how I can customise the dashboard? Right now the Askimet and spam blocks are showing up which i rather not…
I’ve never done it before, but I did see there are some plugins out there that allow you to customize it. I just Googled “How to customize Dashboard” and a few showed up.
You must be logged in to reply to this topic.