images - How can I add "alt" tag to <picture> element?

I am developing my own theme and for logo I usetag:<?php$image_url = get_theme_mod( 'header_logo_image_home�

I am developing my own theme and for logo I use tag:

<?php
   $image_url = get_theme_mod( 'header_logo_image_home', '' );
   $image_id = attachment_url_to_postid($image_url );
?>
   <picture class="lozad" data-src="<?php echo wp_get_attachment_image_src( $image_id, 'logo' )[0]; ?> 1x, <?php echo wp_get_attachment_image_src( $image_id, 'logo-retina' )[0]; ?>  2x" data-alt="====> ? HOW ? <====">
   <source srcset="<?php echo wp_get_attachment_image_src( $image_id, 'logo' )[0]; ?>  1x, <?php echo wp_get_attachment_image_src( $image_id, 'logo-retina' )[0]; ?>  2x">
   </picture>

Is there any way do get ALT based on 'attachment_url_to_postid'?

PS: I use element with lozad.js lazyload script.

Thanks!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745674140a4639580.html

相关推荐

  • images - How can I add &quot;alt&quot; tag to &lt;picture&gt; element?

    I am developing my own theme and for logo I usetag:<?php$image_url = get_theme_mod( 'header_logo_image_home�

    21天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信