How to display header image at top of posts–instead of custom or featured image
-
I’ve searched online for hours for a solution to this and have tried tweaking things…nothing is working.
When I set a featured image in a post, the image appears at the top of the screen, replacing the default header image I created.
I *suspect* it has something to do with this code in the .functions.php section, but I don’t know how to adjust it to get the results I want:
/** * Display either the custom image or default header image * * @since 1.0.0 */ function header_images() { $custom_image = ( is_singular() ) ? get_post_meta( get_the_ID(), 'matheson_custom_image', true ) : ''; if ( is_singular() && ( ! empty( $custom_image ) || has_post_thumbnail() ) ) { if ( $custom_image ) echo '<img src="' . esc_url( $custom_image ) . '" alt="" class="header-img" />'; else the_post_thumbnail( 'full', array( 'class' => 'header-img' ) ); } else { $header_image = get_header_image(); if ( ! empty( $header_image ) ) : ?> <img class="header-img" src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /> <?php endif; } }
Any help?
- The topic ‘How to display header image at top of posts–instead of custom or featured image’ is closed to new replies.