I did several trial and errors to see if I could keep the original code.
But it came down to changing the background size from contain to cover.
A simple fix, yet I made it harder than it needed to be as usual.
#still {
margin-top: 0;
padding-top: 0;
- background-size: contain !important;
+ background-size: cover !important;
/* background-position: center !important;*/
background-repeat: no-repeat !important;
position: relative; }
if (has_post_thumbnail()) {
$image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full");
echo '<header id="still" style="background: url('.$image_data[0].');'
- . 'min-height: 400px;max-height: 400px"></header>';
+ . 'min-height: 400px;max-height: 400px;"></header>';
} else {
echo '<header id="still" style="background: url('.get_template_directory_uri().'/assets/default-header.jpg);'
. 'min-height: 400px;max-height: 400px"></header>';
#still {
margin-top: 0;
padding-top: 0;
- background-size: contain !important;
+ background-size: cover!important;
/* background-position: center !important;*/
background-repeat: no-repeat !important;
position: relative;