- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
The below code adds Register/ Login/ Logout options to the WordPress main navigation menu
…
add_filter(‘wp_nav_menu_items’,’show_register_login_link’);
function show_register_login_link($nav) {
// The “Register” link is not offered if the Administration > Settings > General > Membership: Anyone can register box is not checked.
return $nav.wp_register(“<li class=’menu-item’>”, ““, false).”<li class=’menu-item’>”.wp_loginout(get_site_url(), false).”“;
}
…
Can someone provide some insight on how I would go about adding a CSS class to the string in the above code? Then I would be able to float:right the string to show the Register/ Login/ Logout options to the far right of the WordPress main navigation. Thank you for your time I appreciate it.
Maybe
wp_register('<li class="menu-item wp-register-link">', '', false)
<li class="menu-item wp-logout-link">' . wp_loginout(get_site_url(), false)
notice the additional classes wp-register-link
and wp-logout-link
Then just target them with CSS.
Hope that helps
Alen
Thank you very much , Alen. I will begin working with your suggestions right now and update this. I really appreciate your time.