?
Solved

admin bar shows even when it shouldn't

Posted on 2011-10-05
12
Medium Priority
?
242 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:rogerk_fsww
  • 7
  • 5
12 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 36919424
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.
0
 

Author Comment

by:rogerk_fsww
ID: 36919790
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
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 36920065
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>
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:rogerk_fsww
ID: 36920138
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
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 2000 total points
ID: 36920168
>> Do you think this is a "normal" behavior or did I mess something up with the whole WP theme?

Without seeing the whole thing from the backend, hard to say.  It's certainly not typical theme behavior but whether it is something you did or if the theme is just not constructed properly to handle the admin bar (a relatively new thing) I couldn't tell you.

Personally, I hate the darn thing and disable it via plugin as one of my first actions on a new WP install.
0
 

Author Comment

by:rogerk_fsww
ID: 36920172
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.
0
 

Author Comment

by:rogerk_fsww
ID: 36920197
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
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 36920213
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
0
 

Author Closing Comment

by:rogerk_fsww
ID: 36920227
Great job Jason. Thanks.
0
 

Author Comment

by:rogerk_fsww
ID: 36920243
Hey Jason,

Forgot to ask which plugin you used?

Roger K
0
 

Author Comment

by:rogerk_fsww
ID: 36920299
Awesome - Thanks.
Now back to work on the site.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Transferring a wordpress site from a host or local dev server to another host can be a pain. So I've included my steps on how I have accomplished this task. Steps include an assumption that you have Cpanel access or Ftp access.. If you do not hav…
Wordpress Horizontal Drop-Down Menu In this tutorial I will show you had to add a WordPress horizontal navigation menu to your theme. I have searched and searched for a good tutorial on creating a WordPress nav menu without adding a plug-in or us…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
Suggested Courses
Course of the Month16 days, 23 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question