Link to home
Start Free TrialLog in
Avatar of rogerk_fsww
rogerk_fsww

asked on

admin bar shows even when it shouldn't

hey everyone,

I'm working on a theme for a "non-blogging" Wordpress web site.
In it I have a frontpage.php that is set as static. The problem i have is when I open it in Firefox I still see a margin at the top of frontpage where the admin bar would be. In Chrome it does not show.
In the head section of the header.php there is a <?php wp_head(); ?> tag that if I hide, then the margin is gone. Can i leave this tag out of the header file or is there a way to leave it in and make sure it's always hidden when not logged in?

Thanks,
Roger K
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

How are you hiding the admin bar?  From the user preferences or via a plugin?

wp_head() is a non-critical function, so if you remove it and everything else still works, that's probably ok.
Avatar of rogerk_fsww
rogerk_fsww

ASKER

Hi Jason,

I am new to WP so I'm not sure how it's hidden.
I created a new template page for the home page called frontpage.php using a modified index.php to take out the posts loop. One thing I noticed is that in firebug the head contains this snippet at the end of the head section:
------------------
<style media="print" type="text/css">
#wpadminbar { display:none; }
</style>
<style media="screen" type="text/css">
html { margin-top: 28px !important; }
* html body { margin-top: 28px !important; }
</style>
</head>
-----------------
It appears that this is the margin that I am seeing even though I am just viewing the site from a browser window from /localhost/wordpress/ Not the /localhost/wordpress/wp-admin/ that I think is where it should be appearing. I'm not really clear on how the login part for the blog works. The puzzling thing is that I see it in Firefox but not in Chrome. I guess the easiest thing is just to take out the <?php wp_head(); ?> tag. I just didn't know if that would mess anything else up. I still want to use a page for blogging somewhere after the frontpage.

Thanks again, Roger K
You could also just kill the CSS:

<style media="screen" type="text/css">
html { margin-top: 28px !important; }
* html body { margin-top: 28px !important; }
</style>
I wondered if that would be a problem later with other pages or logging into the admin interface?
I will try that and see what happens when I use the admiin page.
When I have tested it I will get back with results.

Do you think this is a "normal" behavior or did I mess something up with the whole WP theme?
That's what worries me about removing any of the stock code.

later, Roger
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Jason,

One other thought I had was using a conditional php statement to disable it on the front page.
If I did that could I still get into the admin pages? Or would i have to add an Admin login page elsewhere?
My nubie mind has not completely wrapped around the intricacies of WP.

Thanks always.
Jason,

I got your last response while I was writing my next question.
I think I would like to get rid of the bar too, Just too new to know if i have to have it for other stuff.

Roger K
No one needs the Admin Bar.  I wouldn't be surprised to see it die off over time, or at least be set to non-visible by default
Great job Jason. Thanks.
Hey Jason,

Forgot to ask which plugin you used?

Roger K
Awesome - Thanks.
Now back to work on the site.