I’m working on my first wordpress theme and was wondering if someone could help me out with the header.php file.
I’m trying to use the simple lightbox plugin however it needs wp_head(); as it states the professional themes already have this. However I’ve created my own and for some reason done have this. I’ve placed it where wordpress.org syntax helps tells me to place it but then I refresh it and now there is a large white bar going the top of my pages.
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php
if (function_exists('is_tag') && is_tag()) {
single_tag_title("Tag Archive for ""); echo '" - '; }
elseif (is_archive()) {
wp_title(''); echo ' Archive - '; }
elseif (is_search()) {
echo 'Search for "'.wp_specialchars($s).'" - '; }
elseif (!(is_404()) && (is_single()) || (is_page())) {
wp_title(''); echo ' - '; }
elseif (is_404()) {
echo 'Not Found - '; }
if (is_home()) {
bloginfo('name'); echo ' - '; bloginfo('description'); }
else {
bloginfo('name'); }
if ($paged>1) {
echo ' - page '. $paged; }
?></title>
<link rel="shortcut icon" href="/favicon.ico">
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if IE 6]>
<script type="text/javascript" src="js/DD_belatedPNG.js"></script>
<script type="text/javascript">
DD_belatedPNG.fix('.png');
</script>
<![endif]-->
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
Hopefully I have provided enough information as to see if anyone can help me figure out what is happening.
For the white bar coming across your site, it is most likely WordPress trying to display an “admin” bar across the top. This gives logged in users such as yourself (as admin) quick access to add/edit pages, posts etc. This won’t show up properly unless you have wp_head() in the header as well as wp_footer() in your footer.php. The wp_head() will add a top margin to your body tag to account for the admin bar, however without the wp_footer() the bar won’t show up properly thereby showing a blank, white spot where the admin bar would show up. This shouldn’t show for users that are not logged in.
You can, also, disable the admin bar for your specific user if it bothers you by going to your admin screen -> Users -> Your Profile -> and uncheck “Show Toolbar when viewing site”.
You can also disable the admin bar for all logged in users by adding this line to your functions.php file in your themes directory: