Skip to content

Commit

Permalink
added - alt attribute to hero image
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveJonesDev committed May 14, 2024
1 parent 6ace0b7 commit 47bd6c7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions inc/loop.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,14 @@ function eqd_single_header() {
<?php endif; ?>

<?php
$featured_image_id = get_post_thumbnail_id( get_the_ID() );
$featured_image_alt = get_post_meta( $featured_image_id, '_wp_attachment_image_alt', true );
$featured_image = get_the_post_thumbnail_url( get_the_ID() );
if ( $featured_image ) {
?>
<?php echo '<img loading="lazy" src="' . esc_url( $featured_image ) . '" />'; ?>
<?php } ?>
<?php echo '<img loading="lazy" src="' . esc_url( $featured_image ) . '" alt="' . esc_attr( $featured_image_alt ) . '" />'; ?>
<?php
} ?>
</span>
<?php endif; ?>

Expand Down

0 comments on commit 47bd6c7

Please sign in to comment.