Just looking for a little advice on what would be the best way to go about centering the brand (logo) in the Nav bar? (Keeping the menu dynamic of course)
Okay sorry. Well I figured it out anyways. Well I think it may be more than a bootstrap question to be fair, because you could do it easy via just Bootstrap, but it’s more bootstraps integration with the WordPress menu that makes it a little more tricky.
You could create a custom walker, or how about a little jQuery? Link to JSFiddle
It works by hiding the Home text and positioning the img using a pseudo selector. You could alter it to detach and append the li instead, then insert the image, if you want the image to be linkable.
We used the optional “css-class” field that can be set for each item in WordPress under Appearances->Menus. Then in the lib/nav.php walker class we did a check for menu item name and css class, if they both match we replace the menu item with a logotype. Code example below.
Thanks for the replies everyone. I ended up doing pretty much the same thing as olafjlindstrom suggests. But I did also figure out, while messing around with the problem that it could be done with just CSS, but I think it’s a very hacky solution and I wouldn’t necessarily recommended it. But in case anyone is interested this is basically what I did:
I used “:nth-child()” to divide the menu in the center. Like : .navbar-default .navbar-nav > li:nth-child(4) {
margin-left: 20em;
}
The something like: .navbar-default .navbar-nav {
margin-left: 10em;
}
To balance it and of course centering the brand is as simple as something like:
.navbar-brand {
position: absolute;
width: 100%;
bottom: 100px;
left: 0;
text-align: center;
margin: auto;
}
I would note that both mattrads and olafjlindstroms solutions may well be more stable than the one I’ve posted here.