• Resolved pyecrust

    (@pyecrust)


    Hi All,
    First post and new to WordPress so bit of a newbie.
    Using twenty sixteen theme but have it set to static page. Have turned off all menus header etc. and constructed a page as below.
    https://christineheron.com
    Cant get rid of the space where the header would be. How do I get rid of the space all together. Have tried some bits of code off past forum posts using Custom CSS plugin but cant seem to get rid.
    Any help much appreciated. Maybe I just need a theme with a blank page and a blog
    Many thanks, David, UK

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @pyecrust

    The space you see is comming from header.php file.
    If you need nothing in this header section remove or you can comment those bit of shown below:

    <header id="masthead" class="site-header" role="banner">
    			<div class="site-header-main">
    				<div class="site-branding">
    					<?php if ( is_front_page() && is_home() ) : ?>
    						<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    					<?php else : ?>
    						<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
    					<?php endif;
    
    					$description = get_bloginfo( 'description', 'display' );
    					if ( $description || is_customize_preview() ) : ?>
    						<p class="site-description"><?php echo $description; ?></p>
    					<?php endif; ?>
    				</div><!-- .site-branding -->
    
    				<?php if ( has_nav_menu( 'primary' ) || has_nav_menu( 'social' ) ) : ?>
    					<button id="menu-toggle" class="menu-toggle"><?php _e( 'Menu', 'twentysixteen' ); ?></button>
    
    					<div id="site-header-menu" class="site-header-menu">
    						<?php if ( has_nav_menu( 'primary' ) ) : ?>
    							<nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php _e( 'Primary Menu', 'twentysixteen' ); ?>">
    								<?php
    									wp_nav_menu( array(
    										'theme_location' => 'primary',
    										'menu_class'     => 'primary-menu',
    									 ) );
    								?>
    							</nav><!-- .main-navigation -->
    						<?php endif; ?>
    
    						<?php if ( has_nav_menu( 'social' ) ) : ?>
    							<nav id="social-navigation" class="social-navigation" role="navigation" aria-label="<?php _e( 'Social Links Menu', 'twentysixteen' ); ?>">
    								<?php
    									wp_nav_menu( array(
    										'theme_location' => 'social',
    										'menu_class'     => 'social-links-menu',
    										'depth'          => 1,
    										'link_before'    => '<span class="screen-reader-text">',
    										'link_after'     => '</span>',
    									) );
    								?>
    							</nav><!-- .social-navigation -->
    						<?php endif; ?>
    					</div><!-- .site-header-menu -->
    				<?php endif; ?>
    			</div><!-- .site-header-main -->
    
    			<?php if ( get_header_image() ) : ?>
    				<?php
    					/**
    					 * Filter the default twentysixteen custom header sizes attribute.
    					 *
    					 * @since Twenty Sixteen 1.0
    					 *
    					 * @param string $custom_header_sizes sizes attribute
    					 * for Custom Header. Default '(max-width: 709px) 85vw,
    					 * (max-width: 909px) 81vw, (max-width: 1362px) 88vw, 1200px'.
    					 */
    					$custom_header_sizes = apply_filters( 'twentysixteen_custom_header_sizes', '(max-width: 709px) 85vw, (max-width: 909px) 81vw, (max-width: 1362px) 88vw, 1200px' );
    				?>
    				<div class="header-image">
    					<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
    						<img src="<?php header_image(); ?>" srcset="<?php echo esc_attr( wp_get_attachment_image_srcset( get_custom_header()->attachment_id ) ); ?>" sizes="<?php echo esc_attr( $custom_header_sizes ); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>">
    					</a>
    				</div>
    			<?php endif; // End header image check. ?>
    		</header><!-- .site-header -->

    Remember removing this code not only effect the header your menus and other section might not work.
    So you can look properly and remove what you don’t want.

    Best Regards!!

    Cant get rid of the space where the header would be. How do I get rid of the space all together. Have tried some bits of code off past forum posts using Custom CSS plugin but cant seem to get rid.

    You mentioned that you have the custom CSS plugin installed. That makes things easier. You can just add this block of code to the custom CSS area:

    #masthead {
        display: none;
    }

    It does exactly what it looks like; it tells the browser to not display the header.

    Thread Starter pyecrust

    (@pyecrust)

    Thanks Guys for the excellent suggestions.
    went with the custom css code which works a treat.
    Cheers, David

    Hi @pyecrust

    Very happy to hear that your problem was solved.
    Please don’t forget to mark your thread as resolved.
    It will be easy for other to find their solution related to this and marked as resolved.

    Best Regards!!
    Cheers

    Thread Starter pyecrust

    (@pyecrust)

    Good point Sanjog, now resolved.
    Cheers, David

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Removing space at top of page in twenty sixteen’ is closed to new replies.