Support » Themes and Templates » remove wordpress's added stylesheet from head

  • Resolved simbaclaws

    (@simbaclaws)


    Hey all, I’m currently having a little bit of a problem. I’m trying to move the wpadminbar down the page so that it gets aligned with my site’s navigation. My problem is that the <head> tag contains a added stylesheet which adds a margin to the top of html which is used for the wpadminbar so that it gets displayed properly when it’s on top.

    I have tried finding out where this came from, I even did some grep commands in my unix system to try and find the exact styling that was applied in my header inside my theme folder but I can’t seem to find it anywhere. Is this something that is not theme related and added by wordpress itself? It concerns the following css that is inside the <head> tag of my documents:

    <style type="text/css" media="print">#wpadminbar { display:none; }</style>
    <style type="text/css" media="screen">
    	html { margin-top: 32px !important; }
    	* html body { margin-top: 32px !important; }
    	@media screen and ( max-width: 782px ) {
    		html { margin-top: 46px !important; }
    		* html body { margin-top: 46px !important; }
    	}
    </style>

    I’ve tried searching for add_action( ‘wp_head’ in all my theme’s files to check whether this css was added by the theme but it doesn’t seem like it…

Viewing 5 replies - 1 through 5 (of 5 total)
  • Nevermind I fixed my issue with a simple function in my functions.php.

    can you explain to the rest what this function is ?

    Just ran into it myself.

    Put this line in functions.php: add_theme_support( ‘admin-bar’, array( ‘callback’ => ‘__return_false’) );

    mattrock1

    (@mattrock1)

    Thanks @beee, this solved the issue for me. Cheers!

    The code of Beee doesn’t work for me :/

    But this code works for me :
    – Remove <style>.wp-admin-bar{display: none;}</style> in <head></head>
    – Remove admin bar in front end.

    add_filter('show_admin_bar', '__return_false');

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘remove wordpress's added stylesheet from head’ is closed to new replies.