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
评论列表(0条)