• Resolved sminker

    (@sminker)


    I created a child theme of Twenty Eleven, and I followed all sorts of direction for changing the size of the header image at the top of the page. I finally came up with something that worked, and it actually worked for about 10 days, but my site went blank and I got the following message in the site’s error log:

    [23-Mar-2015 14:32:05] PHP Parse error: syntax error, unexpected T_FUNCTION in /home4/sallymin/public_html/447auction/wp-content/themes/447auctiontheme/functions.php on line 28

    I don’t have much in the child theme’s functions.php, but here is the offending code, starting on line 28

    add_filter('twentyeleven_header_image_width', function($size) { return 961; });
    add_filter('twentyeleven_header_image_height', function($size) { return 201; });

    I can’t link back to the site because I reverted it to plain old Twenty Eleven until I can resolve the issue.

Viewing 8 replies - 1 through 8 (of 8 total)
  • What version of PHP are you running?

    You could use this code in your child theme to set the width and height instead:

    $custom_header_child_args = array(
    'width' => 961,
    'height' => 201
    );
    add_theme_support( 'custom-header', $custom_header_child_args );
    Thread Starter sminker

    (@sminker)

    I am using PHP 5.4.24

    Thanks so much for responding to my question!!

    Thread Starter sminker

    (@sminker)

    It worked!! Here’s the website url:

    https://447auction.org

    Thanks again.

    –sally minker

    Thread Starter sminker

    (@sminker)

    Well, it IS working, but I checked the error log and I got this message:

    [25-Mar-2015 17:30:59] PHP Warning: Cannot modify header information – headers already sent by (output started at /home4/sallymin/public_html/447auction/wp-content/themes/447auctiontheme/functions.php:36) in /home4/sallymin/public_html/447auction/wp-includes/functions.php on line 1215

    Is this something I should worry about?

    Thanks,
    Sally

    Have you noticed any problems displaying your site? Can you post the contents of your functions.php to Pastebin and post the link here?

    Thread Starter sminker

    (@sminker)

    I haven’t noticed anything strange. It looks great.

    Here’s a link to the paste bin of my functions.php https://pastebin.com/4tpZHQGp

    After speaking to my web host, I discovered that even though the cPanel was saying that I was on PHP 5.4.whatever, I was actually on PHP 5.2. The tech support guy showed me how to get 5.4 on my site, so that’s working properly.

    Thanks,
    Sally

    If it’s not causing any problems, it’s probably not something to worry about. It’s a bit strange that WP reports the error on line 36 when you only have 34 lines, though. Do you have any whitespace after the closing PHP tag? Also, since you technically don’t need the closing PHP tag, you might try deleting everything after line 32, leaving

    add_theme_support( 'custom-header', $custom_header_child_args );

    as the very last line in the file.

    Thread Starter sminker

    (@sminker)

    I only got the one error, and the site is still functioning.

    Thanks for all your help in resolving this issue. The WordPress community is awesome!

    –sally

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Twenty Eleven Header Size T_FUNCTION error HELP!’ is closed to new replies.