Add class to WordPress admin bar?

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.

Related posts

Leave a Reply

1 comment

  1. 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");