Monthly Archives: February, 2012

Update #4: Using Twitter Bootstrap 2.0 Dropdown Menus with WordPress

Running WordPress on a test instance, it looked like the markup wasn’t quite right.

Essentially, I just added  'container' => false, 'menu_class' => 'nav', options to the menu $args and cleaned the start_el function up a bit.

This stops an extra container div from being created before the ul and adds the nav class to that ul.  The container and everything is left outside of it on purpose, because of all the customizations you may want to do with the responsive options and adding your brand logo… If this was a plugin, there would probably be a options page for handling that stuff, but it remains in loose-code form.

Fixed:
nav class on parent <ul>
clean up code & html

Needs Fixed:
Still not crazy about the code in the start_el function

gist:
gist.github.com/1597994

Update #3: Using Twitter Bootstrap 2.0 Dropdown Menus with WordPress

 

02/17/12 – Updated! Click here for the latest code. After some testing, there were a few fixed to clean up the HTML.

 


Okay, I’ve made a bit of an update to the code.

This should get stock WordPress menus working well with the Twitter Bootstrap 2.0 framework. There are still a few things that need changed, but I need to get a new test instance of WP running first, and I haven’t had the time. We’ll be using it on the station’s site soon, so I imagine it won’t be long before I update it again.

I was thinking of making this a plugin, just to get a plugin out there… not sure.

I’m glad to help anyone with questions, just hit me up in the comments.

Added:
data-toggle attribute
dropdown caret

Needs to be fixed (will be fixed once I get a few minutes to reinstall mamp & such) :
nav class on parent <ul>
clean up code & html

gist:
gist.github.com/1597994

%d bloggers like this: