• Hi there,

    I would really like to add a header image in my Minnow child-theme.

    I already tried adding the following lines of html in my child functions.php:

    $args = array(
    ‘width’ => 980,
    ‘height’ => 60,
    ‘default-image’ => get_template_directory_uri() . ‘/images/header.jpg’,
    ‘uploads’ => true,
    );
    add_theme_support( ‘custom-header’, $args );

    Allthough this added a ‘header image’ option in the customizer section, my site fails to display the images that I uploade there.

    Is there any way to get this working? Perhaps by adding some html-code in the header.php file?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Kathryn Presner

    (@zoonini)

    Perhaps by adding some html-code in the header.php file?

    I think you’re on the right track. In addition to the function, you also need to output the custom header in the theme template. Here’s a Codex page to point you in the right direction:

    https://codex.www.ads-software.com/Function_Reference/the_post_thumbnail

    I don’t think you need a line for a default image since the theme does not include one:

    'default-image' => get_template_directory_uri() . '/images/header.jpg',

    Let me know how it goes.

    Moderator Kathryn Presner

    (@zoonini)

    Oh sorry – I sent you the link for outputting the featured image, not the header. Let me try to find something for you.

    Moderator Kathryn Presner

    (@zoonini)

    You can see an example on the Custom Headers page in the Codex for how to output the header code in the header file:

    https://codex.www.ads-software.com/Custom_Headers

    Scroll down to:

    <img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />

    You can remove the flexible height/width bits if you’re not using a flexible header.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add header image’ is closed to new replies.