Wordpress Menu with a login link

Discussion in 'Web Design' started by CaldwellYSR, Feb 13, 2012.

to remove all ads.
  1. CaldwellYSR

    CaldwellYSR Member

    Messages:
    658
    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>
     
  2. LearnWebDesign

    LearnWebDesign New Member

    Messages:
    29
    why dont you use a plugin?
     
  3. CaldwellYSR

    CaldwellYSR Member

    Messages:
    658
    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...
     
  4. Edge

    Edge Member

    Messages:
    461
    Surely you could add the custom link to wp menus and target the li (which will have an id) with your jquery?
     
  5. LearnWebDesign

    LearnWebDesign New Member

    Messages:
    29
    I know you can do that in Joomla, you can customize just about your entire template and site with html.
     
  6. CaldwellYSR

    CaldwellYSR Member

    Messages:
    658
    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: Feb 15, 2012

Share This Page