Wordpress Menu with a login link

CaldwellYSR

Member
So I have a custom wordpress login form that hides itself and then slides in when you click the login button using jquery. It all works nicely when it's just static content, but I'm running into a problem when I add wp menus in. Basically when it's static my menu looks like:

HTML:
<nav id="main-nav">
<ul>
<li><a href="">Home</a></li>
...
...
...
<li id="login"><a href="" onClick="return false">Login</a></li>
</ul>
</nav>

Then in my CSS I float the #login to the right and keep it on the far right of the navigation menu. (It's a horizontal nav menu). Anyways this all works perfectly. When I try to use wordpress menus, I don't know where to add the login one because now my navigation menu looks like...

PHP:
<nav id="main-nav">
  <?php wp_nav_menu(array('menu' => 'Main Nav Menu')); ?>
</nav>
 

CaldwellYSR

Member
Because I already have it written in the static HTML. I assumed porting it over to the theme would be a simple process. All I need is to append another li>a to the end of the navigation...
 

Edge

Member
Surely you could add the custom link to wp menus and target the li (which will have an id) with your jquery?
 

CaldwellYSR

Member
Alright I figured it out. Using the selector
Code:
li:last-child
I was able to get it work work the way I wanted.
 
Last edited:
Top