WordPress.org

Forums

Twenty Ten : How to edit child functions.php file to mod header image size (6 posts)

  1. mom2ashley
    Member
    Posted 4 years ago #

    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.

  2. mom2ashley
    Member
    Posted 4 years ago #

    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");
  3. alchymyth
    Forum Moderator
    Posted 4 years ago #

    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.

  4. mom2ashley
    Member
    Posted 4 years ago #

    alchymyth - once again, you helped me :)
    Problem solved! I'm a newbie - i'm sure you can tell :)

  5. yazmincoveney
    Member
    Posted 4 years ago #

    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');
    ?>
  6. esmi
    Forum Moderator
    Posted 4 years ago #

    Please post a new topic.

Topic Closed

This topic has been closed to new replies.

About this Topic