我使用Wp 3.4.2和特色图片。在我感觉到标题、备选文本并发布帖子后,html代码如下所示:
<img width="214" height="300" title="" alt="Test" class="frame wp-post-image" src="http://www.website.com/wp-content/uploads/2013/02/Test-214x300.jpg">
有没有办法解决这个问题?我使用Wp 3.4.2和特色图片。在我感觉到标题、备选文本并发布帖子后,html代码如下所示:
<img width="214" height="300" title="" alt="Test" class="frame wp-post-image" src="http://www.website.com/wp-content/uploads/2013/02/Test-214x300.jpg">
有没有办法解决这个问题?您可以尝试此筛选器
add_filter(\'wp_get_attachment_image_attributes\', \'my_img_title\', 10, 2);
function my_img_title($attr, $attachment = null){
$attr[\'title\'] = get_post($attachment->ID)->post_title;
return $attr;
}
它应该在img标记中提供额外的title属性。您还可以使用“post\\u thumbnail\\u html”过滤器编辑html输出。
附言:这里有一个类似的问题:
我正在使用分类法图像插件,并试图对分类法进行排序,但分类法图像效果不佳。这项工作:$terms = get_terms( \'work_cat\', $args ); 但事实并非如此:$terms = apply_filters( \'taxonomy-images-get-terms\', \'\', $args ); 有什么想法吗?以下是完整的查询:<?php $args = array( \'taxonomy\' =>