Correctly using wp_head()

I’m working on my first theme, and I found out that I had to call wp_header() before </head>.

My header.php file has this:

Read More
<!DOCTYPE html>
<html>
    <head>
        <title><?php bloginfo('name'); ?> | <?php the_title(); ?></title>
        <meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
        <meta content='utf-8' http-equiv='encoding'>
        <meta name='viewport' content='width=device-width'>
        <link rel='stylesheet' type='text/css' href='<?php bloginfo('stylesheet_url'); ?>'>
        <link rel='stylesheet' type='text/css' href='<?php bloginfo('template_directory'); ?>/side-nav.css'>
        <?php wp_head(); ?>
    </head>

However, since I started calling this method my header now has some extra fluff that’s messing up my layout.

<!DOCTYPE html>
<html>
    <head>
        <title>Faux Pas Improv Comedy | Hello world!</title>
        <meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
        <meta content='utf-8' http-equiv='encoding'>
        <meta name='viewport' content='width=device-width'>
        <link rel='stylesheet' type='text/css' href='http://localhost/htdocs/wp-content/themes/super-plain/style.css'>
        <link rel='stylesheet' type='text/css' href='http://localhost/htdocs/wp-content/themes/super-plain/side-nav.css'>
        <link rel='stylesheet' id='open-sans-css'  href='//fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&subset=latin%2Clatin-ext&ver=3.8.1' type='text/css' media='all' />
        <link rel='stylesheet' id='dashicons-css'  href='http://localhost/htdocs/wp-includes/css/dashicons.min.css?ver=3.8.1' type='text/css' media='all' />
        <link rel='stylesheet' id='admin-bar-css'  href='http://localhost/htdocs/wp-includes/css/admin-bar.min.css?ver=3.8.1' type='text/css' media='all' />
        <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://localhost/htdocs/xmlrpc.php?rsd" />
        <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://localhost/htdocs/wp-includes/wlwmanifest.xml" /> 
        <meta name="generator" content="WordPress 3.8.1" />
        <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>
    </head>

My question is, how do I remove the extra stuff from being added by wp_header that I don’t need; and what can I absolutely not remove from wp_header?

Related posts

2 comments

  1. That “extra stuff” is for the Admin Bar. If it’s messing up your layout, then you should correct the layout so that it doesn’t mess it up.

Comments are closed.