Top admin bar / toolbar not showing even when logged in, but empty top margin showing?

I wrote a theme and the top admin / tool bar is not showing. I still see an empty margin. Any ideas?

Here the top margin I never set anywhere in my files.

I actually want to show the toolbar completely.

enter image description here

Solutions Collecting From Web of "Top admin bar / toolbar not showing even when logged in, but empty top margin showing?"

It looks like your theme is missing the wp_footer() function, but is containing the wp_header() function.

I can replicate this behavior on the default themes, by removing wp_footer().

The HTML for the admin bar comes from this part in the Core code:

add_action( 'wp_footer', 'wp_admin_bar_render', 1000 );

It’s usually informative to check out the default themes:

The last three lines in the footer.php file in the TwentyTen, TwentyEleven, TwentyTwelve, TwentyThirteen, TwentyFourteen themes are:

<?php wp_footer(); ?>

Keep in mind that writing a good theme is not an easy task.

You only have to read the theme review process on to see the hard work involved.

The following comes through the wp_head() function, for logged in users:

  • the admin-bar stylesheet, is coming

    <link rel='stylesheet' 
          media='all' />
  • the extra white space comes from this part within the <head> tags:

    <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; }

    when the users have the toolbar option selected on their profile page:

    toolbar option

  • the part to disable the admin bar when printing:

    <style type="text/css" media="print">#wpadminbar { display:none; }</style>

To wrap it up:

If you’re logged in, with the toolbar option selected, the theme pages
will have an extra space (32px) at the top. This space is filled up with
the admin bar HTML blocks from the wp_footer(), so make sure you
include this function in your theme’s footer.

Hope this helps.