treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Nav bar is beating me down.

  • I registered a new side bar within wordpress. I am using an aside to wrap my nav bar in.

    //registers new nav bar
    register_sidebar(array('name'=>'navbar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
    ));
    }


    I need to style it with the following and it is destroying me.

    .leftnav{
    float:left;
    width: 125px;
    padding: 10px 0 0 0;
    border-right: solid 1px #000;
    }
    nav ul {
    list-style: none;
    padding-left: 10px;
    }
    nav li a {
    text-decoration: none;
    padding: 5px 0;
    }


    any help is appreciated.
  • What is it doing or not doing that you want it to do? Can you post the html structure that is referencing the css?
  • Im trying to target each li a so I can style them correctly.. here is the html

    <aside class="leftnav">
    <nav>
    <div class="menu-main-nav-menu-container">
    <ul id="menu-main-nav-menu" class="menu">
    <li id="menu-item-9" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-9">
    <a href="http://test/">Home</a&gt;
    </li>
    <li id="menu-item-5" class="menu-item menu-item-type-taxonomy menu-item-object-category current-menu-item menu-item-5">
    <li id="menu-item-6" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-6">
    <li id="menu-item-7" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-7">
    <li id="menu-item-8" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-8">
    <li id="menu-item-43" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-43">
    </ul>
    </div>
    </nav>
    </aside>


    by default wordpress is putting that div in there.

    im using the below ode to call the menu

    <aside class="leftnav"><nav>
    <?php wp_nav_menu(array('menu' => 'Main Nav Menu')); ?>
    </nav></aside>



    can I add a fiter to strip the tags or something?
  • Hi Fectio, Did you manage to resolve your issue? Struggling to understand what's not working? I've just had a look at your HTML and can't see any anchors within most of your li's? Is this intentional?
  • Hello,

    Sorry about the above listed code. I did not expand the
    <li>
    so you could see the anchors. I still was not able to do exactly what I was trying to do, but found a temporary fix. Thanks for taking the time to look at it.
  • I suggest taking a look at this tutorial about wp menus http://digwp.com/2011/11/html-formatting-custom-menus/
  • Thanks alot. I played around with some of the parameters as Chris had and I did not have much luck either. I will look into the other method suggested and the filters seem like a great idea.
  • @Fectio - TheDoc has been really helpful to me getting a wordpress nav bar working to my liking. Maybe you could ask him?
  • I defeated my Nemesis for now.