WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to wordpress theming and I am working on a theme that uses the newest Twitter Bootstrap.

Here is my question: WordPress adds class names to html elements based on whats going on ie:

<ul class="sub-menu">
<li id="menu-item-36" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-36"><a href="#">Category</a></li>

It added the class submenu to the ul, the id menu-item-36 and classes menu-item, menuitem-type-custom, etc to the first list item.

Twitter bootstrap already has styles defined for most of this. How do I change the names of the classes generated by wordpress?

I feel like it would be more of a pain and not good for updates to change these styles names in the bootstrap css file

share|improve this question

I would be careful removing WordPress classes. Some plugins may depend on those classes.

You should be able to pretty easily add your own classes though, as explained in the WordPress Codex. You'd use the nav_menu_css_class filter to alter or add those classes. See the Codex for an example of doing so. I don't know what classes twitter bootstrap wants or needs so I can't really write code for it, and I imagine it would be quite a bit of code anyway to include all the different classes conditionally.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.