0

I'm using Twenty Thirteen Child theme for my website running WP 4.5.3. I would like to change the header banner dimension to 900x480.

The content of my twentythirteen-child/functions.php:

<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}


// remove default action from Twenty Twelve
/*remove_action( 'after_setup_theme', 'twentythirteen_custom_header_setup' );*/

function twentythirteenchild_custom_header_setup() {
    $args = array(
        // Text color and image (empty to use none).
        'default-text-color'     => '220e10',
        'default-image'          => '%s/images/headers/circle.png',

        // Set height and width, with a maximum value for the width.
        'height'                 => 480,
        'width'                  => 900,

        // Callbacks for styling the header and the admin preview.
        'wp-head-callback'       => 'twentythirteen_header_style',
        'admin-head-callback'    => 'twentythirteen_admin_header_style',
        'admin-preview-callback' => 'twentythirteen_admin_header_image',
    );

    add_theme_support( 'custom-header', $args );

}
add_action( 'after_setup_theme', 'twentythirteenchild_custom_header_setup', 11 );

remove_filter( 'HEADER_IMAGE_WIDTH', 'twentyeleven_header_image_width' );
remove_filter( 'HEADER_IMAGE_HEIGHT', 'twentyeleven_header_image_height' );
define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentythirteen_header_image_width', 900 ) );
define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentythirteen_header_image_height', 480 ) );

It works, but only partially.

When adding a 900x480 image, I obtained:

enter image description here

which is good. When either pressing on Crop Image or Skip Cropping, I obtained:

enter image description here

which is not good at all.

Could you please help?

Thank you very much in advance!!

1
  • Any ideas please?
    – f10w
    Commented Jul 19, 2016 at 6:49

1 Answer 1

0

Problem solved.

.site-header {
    background: url(<?php header_image(); ?>) no-repeat scroll top;
    background-size: 900px auto!important;
}

Your Answer

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

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