3

if

 function wpse_custom_header_setup() {
add_theme_support( 'custom-header', apply_filters( 'wpse_header_args', array(
    'width'                  => 1460,
    'height'                 => 220,
) ) );
}
add_action( 'after_setup_theme', 'wpse_custom_header_setup' );

can help define the width of the header in px, how I can set up a header image at 100% to get something similar like http://braidingfreedom.com/?

2 Answers 2

1

The header image is already set to 100% width by default. Check lines 571-578 in style.css of the twenty fourteen theme

#site-header img {
    max-width: 100%;
}

If you need a bigger header, you'll need to set the sizes accordingly in the code in your question, which I suppose you got from one of my previous answers :-)

Just another note here, you can play around with the max width of site-header found in lines 847 to 853.

.site-header {
    background-color: #000;
    max-width: 1260px;
    position: relative;
    width: 100%;
    z-index: 4;
}

You need to set max-width: 1260px; to your set width in your function

2
  • Thanks you, but this is not what I was looking after. I suppose my question is wrong. I will ask a new one. Thanks again, your response is right based on how I asked. Jul 16, 2014 at 22:13
  • Why not edit this question instead of asking a new one? Just a thought.
    – Danger14
    Oct 29, 2015 at 20:09
0

You cannot override the header image width as far as I can tell (I've been working on this myself just now) since it's a hard-wired maximum of 1260 in the image upload/selection for the header - Wordpress will insist that you crop it no matter what you do with the CSS (I couldn't find where to change this in functions.php either, I don't think you can without messing with WP core files).

The best answer I have is to set this:

#site-header {
    position: relative;
    z-index: 3;
    background: url(https://example.com/path/to/img.jpg);
}

in your style.css, where you simply set the url to your desired header image obviously. You will have to also get rid of your existing image somehow, I simply set a transparent image of the same height as the header image.

Unfortunately this image wont resize with the rest of your site but it does mean you get a banner that actually matches for example in my case a 1920 width based site.

Hope that helps. I would have added this as a comment but I don't have the rep yet.

*edit - Actually I just read your OP properly and noticed you ARE messing with WP php, so this post probably not much help sorry :-/ however I am interested in how you reset the max width px since that would suit what I've been trying to do perfectly... I could ditch my current solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.