Viewing 7 replies - 1 through 7 (of 7 total)
  • Do not edit the theme itself. First create a child theme for your changes. Or install a custom CSS plugin.

    Thread Starter kgibson84

    (@kgibson84)

    No worries, child theme done. Just need a image header for my archive.

    In your child theme’s copy of header.php, try replacing:

    <?php if ( get_header_image() ) : ?>
    <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php header_image(); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a>
    <?php endif; ?>
    </header><!-- #masthead -->

    with:

    <?php if ( get_header_image() ) :
    if( is_archive() && !is_home() ) :?>
    <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="url_of_image" class="header-image" width="image_width" height="image_height" alt="" /></a>
    else: ?>
    <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php header_image(); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a>
    <?php endif; endif;?>
    </header><!-- #masthead -->
    Thread Starter kgibson84

    (@kgibson84)

    I put that in and it didn’t seem to work. Am I missing something?

    Can you post a link to your archive page?

    Thread Starter kgibson84

    (@kgibson84)

    It’s not an actual page, just the widget on the right hand side bottom

    https://www.simmonsonstyle.com

    I have found code to make the title ARCHIVES for the widget not appear, but getting an image to appear instead seems to be much tricker.

    Oh sorry! I got it into my head that you were talking about an archive page.

    You should be able to do this using pure CSS. If you use Firefox with the Firebug add-on (or whatever developer tool is available in your web browser), you’ll see that you can style that particular widget using the .widget_archive .widget-title selector.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Adding header image to Archive Widget’ is closed to new replies.