• my function.php file code.

    Thanks,

    <?php
    
    function twentyten_setup() {
    
    }
    	define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) );
    	define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 120 ) );
    
    ?>
Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator t-p

    (@t-p)

    what’s your question?

    Thread Starter nrodger

    (@nrodger)

    Thanks,
    When I pushed submit post, part of the post disappeared and I resent, but now it isn’t showing.
    Here goes:
    I created a child them in Twentyten. I wanted to change the header height only. I created the function.php file within the child theme after searching and trying many suggestions adding a filter as shown in the above post of mine. The image is not changing size but remaining as it’s default height.

    Could you please suggest what I am doing wrong.

    Thanks,
    Nancy

    Moderator t-p

    (@t-p)

    is your folder /wp-content/upload/ writable?

    Thread Starter nrodger

    (@nrodger)

    Yes it is read, write, execute by owner.

    Moderator t-p

    (@t-p)

    Is your image exactly of the size 940X120? make sure you have uploaded it and is in the right folder.

    Thread Starter nrodger

    (@nrodger)

    The image file was uploaded via the header image uploader within wordpress. It is the exact size I want. 940px x 120px
    When I change the size of the image via the header image size filter on the twenty ten function.php (as opposed to my function.php I created for the child theme) the image shows the correct size.

    Would the image need to live somewhere else other then the uploads directory?

    I am wondering if there is something wrong with my php code. I am not savvy in php. The code is up above in my first post.

    Thanks

    Moderator t-p

    (@t-p)

    You should be changing the size in the child theme. Otherwise it defeats the purpose of having a child theme.

    The filters look OK. But there may be problem with your child functions.php

    With a child theme you do not do anything in the parent folder, all changes and additions are done in the child themes folder.

    If you have not done this yet then create a file in your child themes folder called functions.php the file starts with the php tag <?php

    Then you need a function in the file that runs after the theme has been setup, with the after_setup_theme action hook

    <?php
    
    add_action( 'after_setup_theme', 'child_theme_setup' );
    
    if ( !function_exists( 'child_theme_setup' ) ):
    function child_theme_setup() {
    	define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 120 ) );
    }
    endif;

    That’s it done!

    Need a practical tutorial using a Twenty Ten Child Theme?

    I have written one that starts here:

    HTH

    David

    Thread Starter nrodger

    (@nrodger)

    Thanks for you help.
    I found a solution. I replaced the default header image and it’s size in the child’s functions.php and uploaded the new image to an image directory in the child’s theme directory. I may have been missing that piece of the puzzle that you hit on.

    I got help from this post:

    http://wpti.ps/functions/replace-default-header-image-twenty-ten-theme/

    Thanks for your time and patience!!!

    Nancy

    lightrail

    (@lightrail)

    Very helpful! Thanks, Nancy — that post you linked to was exactly what I needed.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘twentyten child function.php filter header image height’ is closed to new replies.