alt
Signed-off-by: Jeff <jeff@gotenzing.com>
Showing
2 changed files
with
13 additions
and
5 deletions
| ... | @@ -48,8 +48,14 @@ $carousel_style = get_field('carousel_style'); | ... | @@ -48,8 +48,14 @@ $carousel_style = get_field('carousel_style'); |
| 48 | <?php $image = get_sub_field('image'); ?> | 48 | <?php $image = get_sub_field('image'); ?> |
| 49 | <div class="row"> | 49 | <div class="row"> |
| 50 | <div class="col-lg-4 col-md-12 promo-image" > | 50 | <div class="col-lg-4 col-md-12 promo-image" > |
| 51 | <?php $image = get_the_post_thumbnail_url( $page->ID, 'medium', array('class' => 'no-lazy-load') ); ?> | 51 | <?php $image = get_the_post_thumbnail_url( $page->ID, 'medium' ); |
| 52 | <img src="<?php echo $image; ?>" alt="" loading="eager"> | 52 | $thumbnail_id = get_post_meta( $page->ID, '_thumbnail_id', true ); |
| 53 | $img_alt = get_post_meta ( $thumbnail_id, '_wp_attachment_image_alt', true ); | ||
| 54 | if(!$img_alt){ | ||
| 55 | $img_alt = get_the_title($thumbnail_id); | ||
| 56 | } | ||
| 57 | ?> | ||
| 58 | <img src="<?php echo $image; ?>" alt="<?php echo $img_alt ?>" loading="eager"> | ||
| 53 | </div> | 59 | </div> |
| 54 | <div class="col-lg-8 col-md-12"> | 60 | <div class="col-lg-8 col-md-12"> |
| 55 | <div class="promo-text"><?php echo get_the_excerpt($page->ID); ?> <a class="understrap-read-more-link" href="<?php echo get_permalink($page->ID);?>">READ MORE</a></div> | 61 | <div class="promo-text"><?php echo get_the_excerpt($page->ID); ?> <a class="understrap-read-more-link" href="<?php echo get_permalink($page->ID);?>">READ MORE</a></div> | ... | ... |
| ... | @@ -52,14 +52,16 @@ if ( !empty( $terms ) && !is_wp_error( $terms ) ){ | ... | @@ -52,14 +52,16 @@ if ( !empty( $terms ) && !is_wp_error( $terms ) ){ |
| 52 | if($imgid) { | 52 | if($imgid) { |
| 53 | $image = wp_get_attachment_image_src($imgid, 'medium'); | 53 | $image = wp_get_attachment_image_src($imgid, 'medium'); |
| 54 | $image = $image[0]; | 54 | $image = $image[0]; |
| 55 | $image_alt = get_post_meta($imgid, '_wp_attachment_image_alt', TRUE); | ||
| 56 | } else if($img ) { | 55 | } else if($img ) { |
| 57 | $image = $img; | 56 | $image = $img; |
| 58 | $image_alt = get_field('alt_text', $search_posts[$i]['ID']); | 57 | } |
| 58 | $image_alt = get_post_meta ( $imgid, '_wp_attachment_image_alt', true ); | ||
| 59 | if(!$image_alt){ | ||
| 60 | $image_alt = get_the_title($imgid); | ||
| 59 | } | 61 | } |
| 60 | 62 | ||
| 61 | ?> | 63 | ?> |
| 62 | <img src='#' data-src="<?= $image ?>" class='lazy' alt='<?= $image_alt ?>' /> | 64 | <img src='<?= $image ?>' loading="eager" alt='<?= $image_alt ?>' /> |
| 63 | </div> | 65 | </div> |
| 64 | <?php endif; ?> | 66 | <?php endif; ?> |
| 65 | <div class='content'> | 67 | <div class='content'> | ... | ... |
-
Please register or sign in to post a comment