• Resolved andrenell

    (@andrenell)


    I made a child template based on the twentyten theme and want to change the default header size from 940px by 198px to 940px by 144px

Viewing 3 replies - 1 through 3 (of 3 total)
  • very good question. I am wondering the exact same thing

    I am assuming you are using a twentyten child theme, like I am.

    The header image size is defined in twentyten’s functions.php file. You can always hack that. But as soon as WordPress is upgraded to the new version, twentyten will be overwritten and you are back to the default header image size.

    Moving the functions.php file to my child theme folder just give me all sorts of errors. There must be a better way.

    OK, I solved this, with some code from Hedengren’s Smashing WordPress Themes.

    Give your child theme a functions.php file. Paste in the following code. Don’t leave any white space or blank lines after the code, btw. This defines your header image as 940×130. Hack and style as needed.

    <?php
    	define('HEADER_TEXTCOLOR', 'ffffff');
    	define('HEADER_IMAGE', get_bloginfo('stylesheet_directory') . '/images/header-default.jpg');
    	define('HEADER_IMAGE_WIDTH', 940);
    	define('HEADER_IMAGE_HEIGHT', 130);
    
    	// The site header function
    	function site_header_style() {
    	    ?><style type="text/css">
    	        div#header {
    	            background: url(<?php header_image(); ?>);
    	        }
    	    </style><?php
    	}
    
    	// The admin header function
    	function admin_header_style() {
    	    ?><style type="text/css">
    	        #headimg {
    	            width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
    	            height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
    	        }
    	    </style><?php
    	}
    
    	// Enable!
    	add_custom_image_header('site_header_style', 'admin_header_style');
    
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change Default Header Size Image for twentyten theme’ is closed to new replies.