wp-bootstrap-navwalker icon indicating copy to clipboard operation
wp-bootstrap-navwalker copied to clipboard

add brand for the first element

Open thetom88 opened this issue 13 years ago • 3 comments

Hello and thank you for your great custom navbar, it helped me a lot. I'm just wondering if it's possible to add the brand tag for the first element. How can i do that?

thetom88 avatar Feb 04 '13 15:02 thetom88

The way the script is setup its pretty simple.

Since the menu wrappers are outside of the navwalker, all you have to do is add the brand anchor right before the menu declaration.

Here is an example with the brand:

<div class="navbar navbar-fixed-top">
  <div class="navbar-inner">
    <a class="brand" href="#">My Brand</a>
    <?php 
        wp_nav_menu( array(
            //'sort_column' => 'menu_order',
            'menu' => 'header_menu',
            'depth' => 2,
            'container'  => false,
            'menu_class'     => 'nav',
            'walker' => new twitter_bootstrap_nav_walker())
        );
    ?>
  </div>
</div>

SideQuestDIY avatar Feb 04 '13 15:02 SideQuestDIY

Thank you for your fast answer! Yes, that's the first thing i've tried, but if i try to add a dropdown on the brand item the layout of the navbar becomes a mess. Could it be better if i add the "brand" class via jquery at the first element of the list? Thank you again for your work!

Il 04/02/2013 16:39, Edward McIntyre ha scritto:

The way the script is setup its pretty simple.

Since the menu wrappers are outside of the navwalker, all you have to do is add the brand anchor right before the menu declaration.

Here is an example with the brand:

— Reply to this email directly or view it on GitHub https://github.com/twittem/wp-bootstrap-navwalker/issues/5#issuecomment-13082382.

thetom88 avatar Feb 04 '13 15:02 thetom88

If you are trying to make a dropdown that looks like the "brand" class I would recommend simply styling the first <li> element with css to look like the "brand" class. That way you have control over how its displayed without errors as you will have to tweek the css anyway.

Depending on your menu structure you can select the first elemnet with somthing like this:

.navbar .nav > li:first-child { } 

SideQuestDIY avatar Feb 04 '13 17:02 SideQuestDIY