WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Change Default Header Size Image for twentyten theme (4 posts)

  1. andrenell
    Member
    Posted 3 years ago #

    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

  2. photocurio
    Member
    Posted 3 years ago #

    very good question. I am wondering the exact same thing

  3. photocurio
    Member
    Posted 3 years ago #

    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.

  4. photocurio
    Member
    Posted 3 years ago #

    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 940x130. 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');
    
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic