dongtiao2976 2017-04-15 15:29
浏览 97

Alt文本未使用wp_get_attachment显示回显

Alt text not showing...

    $images = get_post_meta(get_the_id(), 'vdw_gallery_id', true);



                if( $images ): ?>
                    <ul>
                        <?php foreach( $images as $image ): ?>

                                <li>
                            <a href="<?php echo wp_get_attachment_image_url($image, 'large');  ?>">
                                <img src="<?php echo wp_get_attachment_image_url($image, 'medium'); ?>" alt="Alter TEXT" />
                            </a>
                                </li>
                        <?php endforeach; ?>
                    </ul>
                <?php endif; ?>             

I try many ways but not getting how to echo alter text I create meta field for gallery.

I know wp_get_attachment_image_src this will show everything but I only need to echo "alt" text within loop.

  • 写回答

1条回答

  • douduidui1046 2017-04-15 18:31
    关注

    Make use of the title tag and the alt tag and possibly give it a width and height, check out this comment: https://stackoverflow.com/a/8925364/7862006

    <img alt="alternative text" title="alternative text" style="min-width: 50px; min-height: 25px;" src="..........
    
    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序