• Resolved oldunclechalex

    (@oldunclechalex)


    I studied and studied codex about child theme and understood, that to change the header size I need first to change the header.php and specify the exact size instead of "<?php echo HEADER_IMAGE_WIDTH; ?>" "<?php echo HEADER_IMAGE_HEIGHT; ?>" and put it in the child theme directory.

    Then I should create in the child theme directory a new fuctions.php file confirming this new size like this

    if ( ! function_exists( 'twentyten_setup' ) ):
    
    function twentyten_setup() {
    define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) );
    	define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 614 ) );
    }
    endif;

    But that did not work.

    Kindly explain what I did wrong.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Based on what I found in another forum post, try adding this to the child theme’s functions.php file.

    function my_header_height($size){
       return 110;
    }
    add_filter('twentyten_header_image_height','my_header_height');

    You don’t need to filter the width because 940, what you want to use, is already the default width. The child theme will pick that value up from the parent theme.

    If you wanted to change it, the code would be this:

    function my_header_width($size){
       return 960;
    }
    add_filter('twentyten_header_image_width','my_header_width');
    Thread Starter oldunclechalex

    (@oldunclechalex)

    I solved the problem. I was almost right, the only issue I forgot about was to declare php in the beginning

    <?php
    
    define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) );
    	define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 614 ) );

    Now it works.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘change header size in 2010_child theme’ is closed to new replies.