WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] margin-top added to html and body tags after upgrade to 3.1!?! (35 posts)

  1. fgshepard
    Member
    Posted 3 years ago #

    We upgraded to 3.1 this morning and now find the following style rule dynamically added to our header:
    <style type="text/css">
    html { margin-top: 28px !important; }
    * html body { margin-top: 28px !important; }
    </style>

    This is not in our "header.php" file and so I assume it's being added by wordpress (i.e., there is no evidence that we've been hacked). I'm guessing it has something to do with the new admin bar but not sure. Any ideas what's going on or how to turn it off?

    Here's a URL:
    http://www.ircpl.org

  2. Jack
    Member
    Posted 3 years ago #

    It probably has to do with the new admin bar in top of the screen.

  3. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    <?php
    /* Disable the Admin Bar. */
    remove_action( 'init', 'wp_admin_bar_init' );
    ?>

    your assumption is correct, that is for the admin bar. add this code to functions.php to disable the admin bar if you wish/if necessary

    note that the bar is only visible when you are logged in

  4. fgshepard
    Member
    Posted 3 years ago #

    Thanks for the info. I guess this would have been obvious if the admin bar actually appeared on the site. I am logged in but only see the extra margin -- no admin bar. Is there a setting I need to adjust to make this work?

    Thanks!

    Frank

  5. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    It should show.... is your page fully loaded? My admin bar sometimes seems to hang.... I have to scroll the page up and down to get it to pop into place

    You can check in your user profile I believe to see if you are set up to display the bar

  6. malonn
    Member
    Posted 3 years ago #

    I'm having this exact same problem as fgshepard. I was about to make a new post about it. My admin bar works if I turn it on to display in the admin area, so it's functional, but on the actual website area, it's all white. Firebug reports it as a margin, just as fgshepard descibes.

    I also built the theme I'm using myself, so I'm sure it's a problem with theme compatibility.

    What do?

  7. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Basic testing first, its always the same

    switch to twentyten and see if it works

    then test with all plugins disabled....

    That way you know where the problem lies

  8. malonn
    Member
    Posted 3 years ago #

    For me, I did an absolute clean install. I wiped the DB and deleted everything except my theme files then downloaded the latest release from the site (3.1). And yes, it works in twentyten. I have no plugins installed.

  9. kirkmc
    Member
    Posted 3 years ago #

    In my case, I see the extra margin display as white space, then the rest of the page jumps up into its normal (pre-admin bar) position. So it has to be something in my theme that's preventing its display.

  10. malonn
    Member
    Posted 3 years ago #

    Yes, I also see it as white space. The entire page is pushed down 75ish pixels or so.

    Removing the admin bar from displaying by unchecking it removes the white space, so it's definitely the placeholder for the admin bar.

  11. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Are you able to use firebug to inspect any other possible css conflicts/issues?

  12. fgshepard
    Member
    Posted 3 years ago #

    I've gone into the Webkit element inspector and turned off all of my scripts and stylesheets and still cannot get the admin bar to display. Not sure if this is an effective way to test something like this, however.

  13. malonn
    Member
    Posted 3 years ago #

    Not that I can find.

    HTML checks out as nearly valid (using center tag in one place and & isn't escaped to &ampĀ )

    CSS checks out 100% with CSS 2.1 and 3.0.

  14. drumkeyjw
    Member
    Posted 3 years ago #

    Same here...it goes away when I check "in dashboard" or deselect both options for the "Show menu bar" option.

    I changed my theme to Twenty Ten and the menu bar does show.

    When I switch to the one I made, it does not work. Would love to know how I can have the menu bar show up in the themes I create...

  15. fgshepard
    Member
    Posted 3 years ago #

    Are there any upgrade-specific template changes that might be necessary to make this work? Similar to those necessary to make widgets appear awhile back?

  16. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Do you see the html output for the admin menu? When you view source from in the browser, its waaay at the bottom

    under:

    <div id="wpadminbar">
    			<div class="quicklinks"

    If so, then the output is good.

    After that, it may be css or js conflicts perhaps

    For css focus on anything relevant to your body tag

  17. malonn
    Member
    Posted 3 years ago #

    @Rev. VooDoo

    Nope, I'm missing that code. I think you're on to something, Watson...

  18. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Yeah, if you don't even have the code (and it's a pretty big chunk) at the very bottom of your output, then something is blocking the menu from generating at all....

  19. kirkmc
    Member
    Posted 3 years ago #

    Ok, on my site, it turns out that there was some code in the footer that was commented out. Since the wpadminbar is created by the wp_footer() function, usually called from footer.php in themes, if for any reason this function is commented out, the adminbar won't display. I've un-de-commented this, and it works fine for me now.

    For anyone not seeing the bar: check footer.php if the wp_footer function isn't there or simply commented out.

    I don't recall why I would have commented that out, but there must have been a reason.

  20. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Oh jeez, yeah.... you absolutely must have the wp_footer function

    Somwetimes I forget to ask the really obvious stuff

  21. malonn
    Member
    Posted 3 years ago #

    @kirkmc

    Well I'll be damned. I never put in wp_footer() into my theme. Works great now!

    Thanksssssssssssssssssss a funkload.

  22. fgshepard
    Member
    Posted 3 years ago #

    Worked for me, too. Thanks!

  23. maxdefcon
    Member
    Posted 3 years ago #

    @kirkmc: Do I need to just check the footer.php within the theme or somewhere else?

  24. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    within the theme, you must have:

    <?php wp_footer(); ?>

    usually directly before the </body> tag in footer.php

  25. maxdefcon
    Member
    Posted 3 years ago #

    If that's there, what else could I check to see why the Admin Bar is not showing? It's not even showing within my dashboard. I have both options within my Profile checked too.

  26. maxdefcon
    Member
    Posted 3 years ago #

    I found my issue...

    I went through my plugins one by one. I needed to deactivate WPtouch Pro. Once that was deactivated, the Admin Bar showed within my Dashboard & on my site. I've reported the issue to BraveNewCode.

  27. pat7047
    Member
    Posted 3 years ago #

    @kirkmc Thanks to you and everyone in this thread! I was getting so frustrated trying to figure out where "html { margin-top: 28px !important; }" was coming from!

  28. David Gard
    Member
    Posted 3 years ago #

    Very useful thread and thanks for sharing your solution.

    Personally, I always thought that wp_footer() was not necessary if you had a custom footer, but that just goes to show that I know very little!

  29. 3oh6
    Member
    Posted 3 years ago #

    Thanks for this post. Added wp_footer() and the bar showed up for me as well. Just stopping by to say thanks to all in this post for sorting it out.

  30. foxeye
    Member
    Posted 3 years ago #

    mmm, can we call this a bug? Will this be fixed in future updates?
    Don't think I understand the footer part of this thread. I removed/commanded out the css code in the admin-bar.php to get rid of the margin in logged in mode.

Topic Closed

This topic has been closed to new replies.

About this Topic