Support » Themes and Templates » How to change the height of header on twenty eleven

  • Hi, I’m having trouble re-sizing the header to have a smaller height?

    I’m still new at this and would be great if someone can help me write the CSS for this?
    I have this so far.

    <body <?php body_class(); ?>>
    <?php if (function_exists('AWM_generate_linking_code'))AWM_generate_linking_code(); ?>
    <div id="page" class="hfeed">
    	<header id="branding" role="banner">
    			<hgroup>
    				<h1 id="site-title"><span><a>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span></h1>
    				<h2 id="site-description"><?php bloginfo( 'description' ); ?></h2>
    			</hgroup>
    
    			<?php
    				// Check to see if the header image has been removed
    				$header_image = get_header_image();
    				if ( $header_image ) :
    					// Compatibility with versions of WordPress prior to 3.4.
    					if ( function_exists( 'get_custom_header' ) ) {
    						// We need to figure out what the minimum width should be for our featured image.
    						// This result would be the suggested width if the theme were to implement flexible widths.
    						$header_image_width = get_theme_support( 'custom-header', 'width' );
    					} else {
    						$header_image_width = HEADER_IMAGE_WIDTH;
    					}
    					?>
    			<a>">
    				<?php
    					// The header image
    					// Check if this is a post or page, if it has a thumbnail, and if it's a big one
    					if ( is_singular() && has_post_thumbnail( $post->ID ) &&
    							( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
    							$image[1] >= $header_image_width ) :
    						// Houston, we have a new header image!
    						echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
    					else :
    						// Compatibility with versions of WordPress prior to 3.4.
    						if ( function_exists( 'get_custom_header' ) ) {
    							$header_image_width  = get_custom_header()->width;
    							$header_image_height = get_custom_header()->height;
    						} else {
    							$header_image_width  = HEADER_IMAGE_WIDTH;
    							$header_image_height = HEADER_IMAGE_HEIGHT;
    						}
    						?>
    					<img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
    				<?php endif; // end check for featured image or standard header ?>
    			</a>
    			<?php endif; // end check for removed header image ?>
    
    			<?php
    				// Has the text been hidden?
    				if ( 'blank' == get_header_textcolor() ) :
    			?>
    
    			<?php endif; ?>
    
    			<nav id="access" role="navigation">
    				<h3 class="assistive-text"><?php _e( 'Main menu', 'twentyeleven' ); ?></h3>
    				<?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. */ ?>
    				<div class="skip-link"><a href="#content">"><?php _e( 'Skip to primary content', 'twentyeleven' ); ?></a></div>
    				<div class="skip-link"><a href="#secondary">"><?php _e( 'Skip to secondary content', 'twentyeleven' ); ?></a></div>
    				<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assigned to the primary location is the one used. If one isn't assigned, the menu with the lowest ID is used. */ ?>
    				<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
    			</nav><!-- #access -->
    	</header><!-- #branding -->
    
    	<div id="main">

    Where do I fix the height?

Viewing 15 replies - 1 through 15 (of 24 total)
  • You would alter the height of your theme’s header in the theme’s “style.css” file.

    If I’m not mistaken, the header size adapts to the chosen image.

    So if you alter your image ahead of time and set it as the header, it should fit the image size….

    I’m trying to do this right now – so glad ya’ll are talking about this.

    I made a custom image but when I upload it, the template automatically stretches the image to fit the width of the template and I want to control the width. (Mostly because it looks too big – but also because it moves the Search Box down into the menu bar which looks awful. Anyone know how to get rid of the Search Box or move it at least?)

    Also – anyone know how to increase the width of the single-column in Twenty-eleven?

    Michael

    (@alchymyth)

    Forum Moderator

    Mia1031 In your style CSS file in twentyeleven theme try to find out the section

    #branding img {
    height: auto;
    margin-bottom: -7px;
    width: 100%;
    }

    around line 531 and modify height:auto to height:100px( or some other value as required) Then it ll appear as

    #branding img {
    height: 200px;
    margin-bottom: -7px;
    width: 100%;
    }

    Hi Udaraaka,

    Thank you for your help but I can only find the #branding img under print.
    Is this correct? And even if I changed the branding img to the following like you requested, it doesn’t do anything.
    Can you please help me again?

    [please mark any code according to forum guidelines – http://codex.wordpress.org/Forum_Welcome#Posting_Code ]

    /* =Print
    ----------------------------------------------- */
    
    @media print {
    	body {
    		background: none !important;
    		font-size: 10pt;
    	}
    	footer.entry-meta a[rel=bookmark]:link:after,
    	footer.entry-meta a[rel=bookmark]:visited:after {
    		content: " [" attr(href) "] "; /* Show URLs */
    	}
    	#page {
    		clear: both !important;
    		display: block !important;
    		float: none !important;
    		max-width: 100%;
    		position: relative !important;
    	}
    	#branding {
    		border-top: none !important;
    		padding: 0;
    	}
    	#branding hgroup {
    		margin: 0;
    	}
    	#site-title a {
    		font-size: 21pt;
    	}
    	#site-description {
    		font-size: 10pt;
    	}
    	#branding #searchform {
    		display: none;
    	}
    	#branding img {
    		display: none;
    	}
    	#access {
    		display: none;
    	}
    	#main {
    		border-top: none;
    		box-shadow: none;
    	}
    	#primary {
    		float: left;
    		margin: 0;
    		width: 100%;
    	}
    	#content {
    		margin: 0;
    		width: auto;
    	}

    Thank you!

    Btw this is from style css.

    @mia1031 can you post a link to a sample page of your website? Then may be I can help you.

    Hi udaraaka,

    which php file did you want to see?

    Mia I didn’t ask for any php file just post a link to a page of your current site, so I can examine the header and help you to solve your problem.

    Hi udaraaka,

    Thank you so much for your support.
    Here is the link to a page of my website

    http://tokyoluxe.com/?page_id=18

    I hope this helps.
    I think it’s set to the original pixel HxW for twenty eleven.
    I need to make it half this size.

    in your dark.css file find the area

    #branding {
    border-top: 2px solid #0a0a0a;
    }

    around line 57.

    #branding {
    border-top: 2px solid #0a0a0a;
    height: 100px;
    overflow: hidden;
    }

    and modify that area as above – modify height as needed. But remember, this will only hide the lower part of the image if you keep it the same size. You better crop your images to fit with the height you specify above.

    Sorry, where is the dark.css file?
    The only #branding img { I have in my css file is under print.
    See below.

    /* =Print
    ———————————————– */

    @media print {
    body {
    background: none !important;
    font-size: 10pt;
    }
    footer.entry-meta a[rel=bookmark]:link:after,
    footer.entry-meta a[rel=bookmark]:visited:after {
    content: ” [” attr(href) “] “; /* Show URLs */
    }
    #page {
    clear: both !important;
    display: block !important;
    float: none !important;
    max-width: 100%;
    position: relative !important;

    }
    #branding {
    border-top: none !important;
    padding: 0;
    }

    #branding hgroup {
    margin: 0;
    }
    #site-title a {
    font-size: 21pt;
    }
    #site-description {
    font-size: 10pt;
    }
    #branding #searchform {
    display: none;
    }
    #branding img {
    display: none;

    ——————————————

    Please advise? Even if I change this to the previous height that you have mentioned, it didn’t change anything…

    http://tokyoluxe.com/wp-content/themes/twentyeleven/colors/dark.css

    You can find it in your file manager in your control panel or ftp client at
    wp-content/themes/twentyeleven/colors/dark.css

    Wow Udaraaka,

    Thank you so much! It worked!!
    So I’m assuming this dark. css is the original copy so when I need to edit something I can adjust the size like the width and height to customize it.
    Am i correct?

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘How to change the height of header on twenty eleven’ is closed to new replies.