Forums

[resolved] Using get_header or get_footer causes gap between #wrapper and body (8 posts)

  1. dguyen
    Member
    Posted 1 year ago #

    When creating my template if I include:
    get_header or get_footer
    I get a gap between my #wrapper and the top and bottom of the body page. If I remove the tags and just include the code all within one template file, the problem goes away...can someone please help?

    I apologize but my build is local and I don't have a link to it.

    I remember reading somewhere about an issue with Multisite -which I may have to break one of my divs from the header.php file into the template.php file?

  2. Person
    Member
    Posted 1 year ago #

    As far as I know, get_header and get_footer simply include the header.php and footer.php files, so there's no reason why there should be an extra gap unless you're adding extra code that you didn't when you put everything in one file.

  3. Andrea_r
    team pirate
    Posted 1 year ago #

    This shouldn't have an issue with multisite at all.

  4. dguyen
    Member
    Posted 1 year ago #

    Thank you so much for the replies...I've racked my brain for another hour or so ... can't figure it out. Here is the entire page.php template file below.
    All works fine when the browser calls this file...but if I cut out everything #main div and above and place it in the header.php file and cut everything #footer and below into footer.php (whilst making my get_header and get_footer calls) I get a gap. No errors.

    I did notice nothing wrong when viewing the source, but inside Firebug, there are scripts/links from <head> showing up inside the <body> tag... which Firebug measures 14px in height...

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <?php wp_enqueue_script('jquery'); ?>
    <?php wp_head(); ?>
    </head>
    
    <body <?php body_class(); ?>>
    
    	<div id="wrapper">
    
    		<div id="header">
    
    			<div id="badge"><a href=<?php bloginfo('home'); ?>>Logo</a></div>
    
    			<ul id="menu">
    
    				<li class="about_us"><a href="<?php bloginfo('url'); ?>/about">About Us</a></li>
    				<li class="how_it_works"><a href="#">How it Works</a></li>
    				<li class="contact_us"><a href="#">Contact Us</a></li>
    				<li class="sign_up"><a href="#">Sign Up</a></li>
    
    			</ul>
    
    			<br class="clearfix" />
    
    		</div><!-- end #header -->
    
    				<div id="page_quote" class="large_quote black">
    			“Never has design been more important”
    		</div>
    
    		<div id="main">
    
    			<div id="content">
    
    				<?php if (have_posts()) : ?>
    
    					<?php while (have_posts()) : the_post(); ?>
    
    						<div <?php post_class(); ?> id="post-<?php the_id(); ?>">
    
    							<h1><?php the_title(); ?></h1>
    
    							<?php the_content(); ?>
    
    						</div><!-- end of each .post -->
    
    					<?php endwhile; ?>
    
    				<?php else : ?>
    
    				<?php endif; ?>
    
    			</div><!-- end #content -->
    
    			<br class="clearfix" />
    
    		</div><!-- end #main -->
    
    		<div id="footer">
    
    			<div class="sub">
    				<p>All content are copyright of FAQsMe. All Right Reserved.</p>
    			</div>
    
    		</div><!-- end #footer -->
    
    	</div><!-- end #wrapper -->
    
    <?php wp_footer(); ?>
    </body>
    
    </html>

    I must be completely dense? When comparing Firebug with the single page.php file vs. page.php (with get_header/get_footer) why are the link <head> links showing inside the <body> tags?

  5. dguyen
    Member
    Posted 1 year ago #

    Alright, after some more deduction... I assume my extra padding between my #wrapper and the body is from the unusual placement of my <head> scripts/links inside of the <body> tags just before #wrapper. (ie. stylesheet, jQuery script, EditURI, WLWmanifest -which Firebug says these links are 0x14px in size)

    So the question is...
    Why are my <head> links/scripts finding their way inside the <body> tags when I use the get_header and get_footer calls?

    ... is someone going to tell me how blatantly blind I'm being? What am I missing?

  6. dguyen
    Member
    Posted 1 year ago #

    I decided to copy and paste my code work into a new text document and for some reason everything is fine. Maybe there was an issue with my original document... ASCII, UTF-8, etc...?

  7. abrudtkuhl
    Member
    Posted 1 year ago #

    I am having this same issue however copy and paste into a new document didnt work for m

  8. apparentlyrich
    Member
    Posted 1 year ago #

    abrudtkuhl, I'm having the same issue also. Not really sure what's wrong with the code as before I upgraded the the Nightly's everything was working pretty well with no gap.

Topic Closed

This topic has been closed to new replies.

About this Topic