Skip to content

WordPress: Add Inline CSS to the Frontend or Backend

man in red jacket riding bicycle

SOmetimes you need a quick and diry fix for something, whether it is a backend issue, or a frontend styling thing. If you plan to later move all changes to the style.css or your agency plugin you still might want to not only test everything with the inspector.

Here is a quick snippet to integrate CSS the hard and dirty way:

// customize admin bar css
function override_admin_bar_css() { 
   if ( is_admin_bar_showing() ) { ?>
      <style type="text/css">
         /* add your style here */
      </style>
   <?php }
}
// on backend area
add_action( 'admin_head', 'override_admin_bar_css' );
// on frontend area
add_action( 'wp_head', 'override_admin_bar_css' );

Dieser Beitrag hat 0 Kommentare

Schreibe einen Kommentar

Deine E-Mail wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

An den Anfang scrollen