Support » Themes and Templates » different headers (by page template) in twenty eleven child theme

  • Resolved Marlene

    (@marlenziux)


    Hi all,
    I want to know if its possible to have a different size of the header image in twenty elevent theme, for example:
    Template one:header image 980 x350:
    (Important: I have changed already the default size for the template:

    function my_header_image_height($height) {
    	return 350;
    }
    add_filter( 'twentyeleven_header_image_height', 'my_header_image_height');
    
    function my_header_image_width($width) {
    	return 980;
    }
    add_filter( 'twentyeleven_header_image_width', 'my_header_image_width');

    )
    Template two: header image 980×100.
    Here is the problem because it gets the values of template one (setted up by php code in functions.php for my child theme.
    I’m not a developer so I guess there is a php function to do this, any help?
    thank you in advance

Viewing 7 replies - 1 through 7 (of 7 total)
  • any help on this?? I would like to know how to do it!!

    2011’s header-image already has flexible-height built in, and the header-image itself depends on the featured image of that post/page being display.

    So you do not need to do anything extra with any php or css. All you need to do is assign a featured image for each post/page and make sure its width is equal or higher than 1000px.

    Making the header-image smaller than 1000px (in width) doesn’t make sense anyway, because the theme’s width is 1000px in normal situation, so 1000px is it.

    thank you Paulwpxp but this doesn’t answer my question, as you can see inthe code, the height and width are managed by code:

    function my_header_image_height($height) {
    	return 350;
    }
    add_filter( 'twentyeleven_header_image_height', 'my_header_image_height');

    If the flexible-height is built how can I change this code?, if I add a different high image, the code resize the image…
    the change to 980px is because the design is built like that, but in any case the widht isn’t an issue…

    So you do not need to do anything extra with any php or css. All you need to do is assign a featured image for each post/page and make sure its width is equal or higher than 1000px.

    sorry, english is not my mother tounge, so maybe I’m not explaingin very good my issue :S
    I have setted up the featured image, but let say that at the subpages I want to have a smaller image (only height) than the main pages, the code is setted up for the images to have always the same height and width, so if my image is smaller, it stretches the image until the height and width is the same in the code.

    Suppose you have a site structure like this

    — Fruit
    ——— Apple
    ——— Orange

    On the Fruit page, you want a bigger header image than Apple and Orange which are subpages, am I correct ? If that’s so, suppose the bigger size is 1000×200, and the smaller size for subpages is 1000×150, then you would prepare these images.

    featured-image-fruit.jpg  | w=1000px, h=200px
    featured-image-apple.jpg  | w=1000px, h=150px
    featured-image-orange.jpg | w=1000px, h=150px

    When you edit each page, just upload AND assign each image as featured, it will be used as custom-header automatically and will be displayed as is.

    Here is the proof, it’s from my local using WP3.5.1 with 2011 that comes with it.

    Parent page = 1000×200
    http://i.imgur.com/uQV0zfJ.png

    Sub page = 1000×150

    twentyeleven wp theme header image

    Well… now it works!!, I’ve been searching this for weeks!, maybe they fixed in the latest update but this didn’t work before…
    Thank you Paulwpxp! 😀

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘different headers (by page template) in twenty eleven child theme’ is closed to new replies.