我想添加alt属性以在我的博客上张贴缩略图。将图像添加到WP后缩略图
我得到的alt文本回声,但不是作为一个属性,但作为文本!
<?php if (has_post_thumbnail()) {$image_src = wp_get_attachment_image_src(get_post_thumbnail_id(),’thumbnail’); $image_alt = wpseoFocusKW();
echo '<img width="100%" src="' . $image_src[0] . '" alt=' . $image_alt .' >';} ?></div></div>
你可以看到这里的问题:http://benefacto.org/three-days-paid-volunteering-leave-an-update-from-rob-wilsons-office/
你会注意到我使用的Yoast关键字为ALT,工作正常。
任何想法非常赞赏。
本
你缺少了'“''上的属性alt'感谢 –
@sebastianbrosch我更新了它,以包括“”,但它没有任何区别,奇怪! –
你也使用back ticks而不是单引号'thumbnail'周围 – Und3rTow