WordPress.org

Ready to get started?Download WordPress

Forums

[closed] Change Twenty Thirteen Header Image size (16 posts)

  1. bluejpro
    Member
    Posted 11 months ago #

    Hello

    I want to change the dimensions of the custom header to 960px width, 295px height.

    This is done in a child theme of course.

    I see Twenty Thirteen has the function twentythirteen_custom_header_setup in custom-header.php in the inc/folder.

    I have copied this to my child theme folder, and changed the 'height' and 'width' values on lines 29 and 30.

    But this doesn't seem to have any effect. The crop tool still seems to be configured for the original height and width of TwentyThirteen

    Advice appreciated.

  2. paulwpxp
    Font hero
    Posted 11 months ago #

    A few things to consider.

    • Max width of this theme is 1080px, so the 960x295 header won't look good in it, you have to scale it up to have a width of 1080px.
    • Theme uses header image, set as fixed size 1600x230 in function, as background image in CSS streched to its max width of custom header width (1600px).
      .site-header {
      	background: url(<?php header_image(); ?>) no-repeat scroll top;
      	background-size: 1600px auto;
      }
    • Child theme could override the size (1600x230) to something else, but it's better to define the 'flex-width' and 'flex-height' to true.
    • The fact of its use of background CSS renders the above pointless, since we will have to do thing in child theme stylesheet anyway, why not just do it all there ?

    Suggestion: If you don't care for the upload functionality, just click remove header image under Appearance > header, and do it all in child theme stylesheet.

  3. Red1
    Member
    Posted 11 months ago #

    I have similar query, but I'm happy with 1080px.

    Not being so bright, why have a 1600px header image when max width set to 1080px?

    So how do I replace with a simple 1080px image in child?

  4. paulwpxp
    Font hero
    Posted 11 months ago #

    Header image in Twentythirteen theme is not responsive and will never be, it's implemented as background image for a div with fixed height. Even if the fixed height is taken out, still there is no CSS way (that I know of) to make a <div> responsive proportionally width AND height the same as <img> with responsive class.

    So we can either do 1. or 2.

    1. Overwrite header.php putting in a real <img> and adjust some CSS.
    2. Do it in CSS only.

    The 1. will give you full control. Depending on the type of image, the 2. will be more efficient because there is no need to create a child theme and all that.

    You can change/remove the fixed height, remove bg image from .site-header and use it in .home-link instead. Changing the background position based on a few media queries making sure the important part is displayed. Or use it as image replacement for h1.site-title, if that's a small size logo.

    So it depends on the type of the image and what you want to do with it.

  5. tommywik
    Member
    Posted 11 months ago #

    Paul, could you please give some details/examples of code changes needed, since I am not very experienced in this.

    I really do not want to change anything in the behaviour, just need to change the proportions in the header image. That is, I want to keep width 1600 but change height to 425.

  6. Ohhhhhhballs
    Member
    Posted 11 months ago #

    Paul, I'm another inexperienced user that would be grateful to see more details about implementing the first of the two options that you mentioned. Thank you.

  7. Andrew
    Forum Moderator
    Posted 11 months ago #

    You can create your own threads to discuss your own issues.

  8. differentCharacter
    Member
    Posted 11 months ago #

    For anyone still struggling - to change the header height you can add something like this in the child themes style.css document:

    .site-header .home-link {
    	min-height: 100px; /*or whatever height you want.*/
    }

    Hope this helps - it's not the only solution, but it should do the job.

  9. DJ Allyn
    Member
    Posted 11 months ago #

    I am trying to use an image that is 1600 wide and 288 high. My problem is that when I use the image uploader in the header section of the theme, it still tries to crop my image to 230 high. Is there any way to override that? Like change its cropping dimension to a different height?

    I've already tried @differentCharacter example to change the min-height to 288 but that doesn't seem to work.

  10. Andrew
    Forum Moderator
    Posted 11 months ago #

  11. DJ Allyn
    Member
    Posted 11 months ago #

    @Andrew Nevins Forgive me, and I don't mean to be rude, but my issue is pretty much the same issue that this thread was started on. Starting a new thread would be counterproductive since it would require someone to post the answers in more than one spot.

    But I did manage to find a work around by finding and replacing the cropped image with the original image and changing the min-height to my required 288px.

    See? One thread, and I got the answer I needed with no help from you. Next time, if I have a question that needs an answer, and nobody else has asked it, THEN I will create my own thread.

  12. Andrew
    Forum Moderator
    Posted 11 months ago #

    See? One thread, and I got the answer

    Yeah, but you would have gotten the answer regardless of whether you posted in this thread. So, please, unless you are contributing towards the original poster's solution, create your own thread to discuss your own issue.

  13. Andrew
    Forum Moderator
    Posted 11 months ago #

    Next time, if I have a question that needs an answer, and nobody else has asked it, THEN I will create my own thread.

    Sorry, but that's just not going to happen. See being mod watched.

  14. Ricardo Tosin
    Member
    Posted 11 months ago #

    If i`m not wrong, to do it you will need to apply a filter in your code, to change the twentythirteen_custom_header_setup, so when you load your page the function will register the older function before your new child theme function , and so you will need to filter that an call again to overwrite it !!

  15. jana-sebastian
    Member
    Posted 11 months ago #

    Having the same problem, trying to upload a 1600px wide header, but with a reduced height. Tried 'a different character's' solution, and it works while I am editing the site. When i log out, view on different browsers, or view pages, the layout flashes and jumps from orig/template to my customised view. Is there a better way to reduce the height of the header ?

  16. esmi
    Forum Moderator
    Posted 11 months ago #

    @jana-sebastian: As per the Forum Welcome, please post your own topic in the correct forum.

Topic Closed

This topic has been closed to new replies.

About this Topic