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

How can I to add a wrapper class to the WordPress admin bar?

I would like to center the contents to the same width as my theme.

share|improve this question
up vote 1 down vote accepted

There isn't a filter/wrapper for the admin bar CSS that you can plug into , the function is simply

  function wp_admin_bar_header() { ?>
  <style type="text/css" media="print">#wpadminbar { display:none; }</style>

You can over ride the CSS using !important or use jQuery to prepend a class/id to the bar.

Something like:

jQuery("<div id='custom-width'></div>").prependTo("#wpadminbar");
share|improve this answer
Thanks @Wyck for the clarification. – mattrepublic Oct 14 '11 at 12:05

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.