WordPress.org

Support

Support » Themes and Templates » Twenty Ten : How to edit child functions.php file to mod header image size

Twenty Ten : How to edit child functions.php file to mod header image size

  • mom2ashley
    Member

    @mom2ashley

    Hi,
    I would like to change the header image height from the original to 300px. I know this is located in the functions.php file. I’m trying to create a child functions.php file and I followed the instructions in here and this is how my child functions.php look like :

    <?php
    
    add_filter('twentyten_header_image_height','my_header_height');
    add_filter('twentyten_header_image_width','my_header_width');
    function my_header_height($size){
       return 300;
    }
    function my_header_width($size){
       return 940;
    }
    endif;

    However when this child functions.php file is in the twentyten-child folder along with the child style.css file, I get this error when I try to activate the child theme :
    The website cannot display the page
    HTTP 500
    Most likely causes:
    The website is under maintenance.
    The website has a programming error.

    When I remove the functions.php from the twentyten-child folder, all is ok. What is wrong with my child functions.php code? What am i missing?

    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • mom2ashley
    Member

    @mom2ashley

    Do we need to include the top bits similar to the top bits in a child style.css file into a child functions.php file too like the following?

    /*
    Theme Name: Twentyten-child
    Theme URI:
    Description: Child Theme for Twentyten theme
    Author: xxx
    Author URI: xxx
    Template: twentyten
    Version: 0.1
    */
    
    @import url("../twentyten/style.css");
    Michael
    Moderator

    @alchymyth

    Do we need to include the top bits similar to the top bits in a child style.css file into a child functions.php file too like the following?

    no

    the error might be caused by the lonely and unrelated
    endif;
    in functions.php of your theme.

    mom2ashley
    Member

    @mom2ashley

    alchymyth – once again, you helped me 🙂
    Problem solved! I’m a newbie – i’m sure you can tell 🙂

    yazmincoveney
    Member

    @yazmincoveney

    I am also trying to modify my functions.php in a child theme. Ultimately I want to exclude specific categories from my blog home page. I am using this code, but it doesn’t seem to do anything.

    <?php
    function exclude_category($query) {
    if ( $query->is_home ) {
    $query->set('cat', '-10 -11 -12');
    }
    return $query;
    }
    add_filter('pre_get_posts', 'exclude_category');
    ?>
    esmi
    Forum Moderator

    @esmi

    Please post a new topic.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Twenty Ten : How to edit child functions.php file to mod header image size’ is closed to new replies.