title: WordPress add Login/Logout to menu editor
body: <p>Ok, so I found this code, which I modified to suit my needs. Btw, I'm using WooCommerce, which explains the "wc" in some of the function calls:</p>
  
  <pre><code>//Add login/logout link to primary menu
  add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
  function add_loginout_link( $items, $args ) {
      if (is_user_logged_in() &amp;&amp; $args-&gt;theme_location == 'primary') {
          $items .= '&lt;li&gt;&lt;a href="'. wc_get_endpoint_url( 'customer-logout', '', wc_get_page_permalink( 'myaccount' ) ) .'"&gt;Log Out&lt;/a&gt;&lt;/li&gt;';
      }
      elseif (!is_user_logged_in() &amp;&amp; $args-&gt;theme_location == 'primary') {
          $items .= '&lt;li&gt;&lt;a href="'. wc_get_page_permalink( 'myaccount' ) .'"&gt;Log In&lt;/a&gt;&lt;/li&gt;';
      }
      return $items;
  </code></pre>
  
  <p>This adds the login/logout menu items, and they work fine. However, they're stuck at the end of the menu, at the moment. I'd like to be able to edit the position using the editor in wp-admin. The solution I thought of was to maybe just create login and logout pages, and use header location redirects with those lines of code in them to get to the proper URLs, but the issue I see with that is that there will always be a login item and logout, no matter what status the user is currently in. Would there maybe be a way to dynamically add a site-wide CSS rule to hide the opposite menu item, based on the log in status?</p>
  
  <p>Or is there an easier way?</p>