• When adding the code to generate the page content into my template, then a white space appears between my header and content area, please see url

    http://www.birthdaymagiciannyc.com/corporate/

    the template code for this page is

    <?php /*
     Template Name: template1*/ ?> 
    
    <?php get_header(); ?>
    
        <div id="content">
    <?php if (have_posts()) : while (have_posts()) : the_post();?>
    <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
    <?php endwhile; endif; ?>
        </div>
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?> 
    
    </div>

    When I remove the code for the page post, then it looks fine (obviously without content thought) like here

    http://www.birthdaymagiciannyc.com/bio/

    the code for this is

    <?php /*
     Template Name: template2*/ ?> 
    
    <?php get_header(); ?>
    
        <div id="content">
        </div>
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?> 
    
      </div>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser.]

    So obviously wordpress generates a white space between my header and content div when the code for a page post is added.

    This is driving me crazy and I do not know what do about it. Could you please help?

    Thank you
    Eva

Viewing 4 replies - 1 through 4 (of 4 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Anything to-do with your theme’s CSS?

    Thread Starter evawright

    (@evawright)

    Not sure, I have inspected this with firebug and can’t see an element at all there. Its a big mystery… If there is anyone out there who knows why this could be, I would be ever so grateful if you could let me know.
    Thanks

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What if you assign your main div a black background colour instead of white?

    Thread Starter evawright

    (@evawright)

    I have done that now… thank you. I should have thought of that solution myself, as its so simple… Still strange though that the content div gets moved down by the wordpress page code.
    Thank you, I appreciate your input!
    Eva

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘White space between header and content’ is closed to new replies.