Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Possible Duplicate:
How to use logout function on custom menu link?

I want to add a logout button at very last of my nav.. I Found a function

// functions.php
function add_login_logout_link($items, $args)
{
  if(is_user_logged_in())
  {
    $newitems = '<li><a title="Logout" href="'. wp_logout_url('index.php') .'">Logout</a></li>';
    $newitems .= $items;
  }
  else
  {
    $newitems = '<li><a title="Login" href="'. wp_login_url('index.php') .'">Login</a></li>';
    $newitems .= $items;
  }
  return $newitems;
}
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);

But It adds Logout button to the very start of the nav, and i want to to be displayed on very Last. (Ideally it should be float:right, as other menu items are float:left)

Thanks

share|improve this question
add comment

marked as duplicate by toscho Jun 13 '12 at 6:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

Sorted!

Just Added

style="float:right;" with <li>
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.