My website is on the Genesis Framework and I’ve added the follow to my functions.php to output a full width after_header image on single pages.
add_action ( 'genesis_after_header', 'bl_featured_image', 9 );
//* Display Featured image after header
function bl_featured_image() {
if ( has_post_thumbnail() && ( is_page() || is_single() ) && 0 === get_query_var( 'page' ) ) {
// Get the URL of featured image
$image = genesis_get_image( 'format=url' );
// Get the alt text of featured image
$thumb_id = get_post_thumbnail_id( get_the_ID() );
$alt = get_post_meta( $thumb_id, '_wp_attachment_image_alt', true );
// If no alt text is present for featured image, set it to Post/Page title
if ( '' == $alt ) {
$alt = the_title_attribute( 'echo=0' );
}
// Display featured image
printf(
'<div class="my-featured-image">
</div>',
esc_url( $image ),
$alt
);
}
}
I have tried adding the following into the default-theme.php in my child theme directory; and still no luck.
add_action ( 'genesis_after_header', 'bl_featured_image', 9 );
function add_month_view_header_img( printf ) {
if ( ! tribe_is_month() ) return printf;
// Display featured image
printf(
'<div class="my-featured-image">
</div>',
esc_url( $image ),
$alt
);
}
Can anyone assist me with adding the full width header image hooked into the ‘genesis_after_header’ location?