WordPress.org

Support

Support » Themes and Templates » [Resolved] Twenty Eleven header image size

[Resolved] Twenty Eleven header image size

  • spackletoe
    Participant

    @spackletoe

    I edited the style sheet to change the theme’s width to 980, so I’d like to change the dimensions that the header image upload tool is expecting to 980×350. Where would I go to do that?

    Thanks!

Viewing 15 replies - 1 through 15 (of 25 total)
  • Michael
    Forum Moderator

    @alchymyth

    functions.php:

    line 122+:

    define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyeleven_header_image_width', 1000 ) );
    	define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyeleven_header_image_height', 288 ) );
    spackletoe
    Participant

    @spackletoe

    Thank you!! New world’s record for a question being answered.

    Is there a way to include this kind of code in a child theme?

    Joanne
    Participant

    @bluejpro

    Lotrr —
    This post from wpti.ps goes into detail about removing and replacing the header image in a twenty eleven child theme – even changing the size – using functions.php.

    http://wpti.ps/functions/replace-remove-header-image-twenty-eleven-theme/

    I’m trying it right now.

    Joanne
    Participant

    @bluejpro

    Even better help here – if you just want to change the default header image size in twenty eleven

    Twenty Eleven Header Image How to Change size

    MyAwesomeBlog
    Member

    @myawesomeblog

    cristopher_elsner
    Member

    @cristopher_elsner

    hi MyAwesomeBlog

    Find “#branding img” in css and set Height and Width of image.

    best luck.

    mr49online
    Member

    @mr49online

    After R&D the best solution that i come to know is that, create its child theme, and do any kind of customization there. To create child theme please checkout this link.

    theBrettman
    Member

    @thebrettman

    You’re all doing it wrong! There’s two ways to do it right. Either make your own variable to replace HEADER_IMAGE_HEIGHT and HEADER_IMAGE_WIDTH in your functions.php and define a new variable (also replacing the variables in your template files), or remove the filter and redefine it in your functions.php:

    remove_filter( 'HEADER_IMAGE_WIDTH', 'twentyeleven_header_image_width' );
    remove_filter( 'HEADER_IMAGE_HEIGHT', 'twentyeleven_header_image_height' );
    define( 'HEADER_IMAGE_WIDTH', apply_filters( 'child_header_image_width', 1280 ) );
    define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'child_header_image_height', 200 ) );

    I prefer the latter so I don’t have to find/replace HEADER_IMAGE_WIDTH & HEADER_IMAGE_HEIGHT with new variables. I just add those four lines to my functions.php and I’m done! Since it is in my child theme, I never have to worry about it getting overwritten on update and if you don’t remove_filter() on each first, it will show in your debug log (if you use one) because those variables are already defined.

    David Borrink
    Participant

    @davidborrink

    the Brettman,

    Thanks! I just needed a quick example of how to write it up. Works like a charm.

    patrick_kelley
    Member

    @patrick_kelley

    @thebrettman: Hi, added your code to my custom functions.php and received the following error message when logging in to the dashboard:

    Warning: Cannot modify header information - headers already sent by (output started at /home/redmon6/public_html/test/wp-content/themes/twentyeleven-child/functions.php:8) in /home/redmon6/public_html/test/wp-includes/pluggable.php on line 866

    patrick_kelley
    Member

    @patrick_kelley

    I found the answer in the FAQ — spurious characters added at the end of the file by Expression Web. Solved by saving in Notepad after deleting junk after closing PHP tag.

    Solving the “headers already sent” problem

    danapalooza
    Member

    @danapalooza

    This is mostly what I needed. What about manipulating the header image size on a per-page basis? In other words, having different page templates with different header image sizes.

    esmi
    Forum Moderator

    @esmi

    Please post a new topic.

    danapalooza
    Member

    @danapalooza

    @esmi Will do.

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘[Resolved] Twenty Eleven header image size’ is closed to new replies.