Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用帖子标题作为特色图片';Wordpress中的alt文本是什么?_Php_Image_Wordpress_Seo_Alt - Fatal编程技术网

Php 如何使用帖子标题作为特色图片';Wordpress中的alt文本是什么?

Php 如何使用帖子标题作为特色图片';Wordpress中的alt文本是什么?,php,image,wordpress,seo,alt,Php,Image,Wordpress,Seo,Alt,我如何使用文章标题作为Wordpress中文章特色图片的alt文本 请告诉我如何/在哪里调整WordPress核心文件以实现这一点,因为我现在使用的主题似乎对重新编写图像的alt标记的插件没有任何反应 谢谢大家! 无需更改WordPress核心文件:) 只需在主题中找到使用了“\u post\u缩略图”(函数的位置,然后将其更改为: $title=get_the_title(); the_post_thumbnail( array(150, 150),array( 'alt' =>$tit

我如何使用文章标题作为Wordpress中文章特色图片的alt文本

请告诉我如何/在哪里调整WordPress核心文件以实现这一点,因为我现在使用的主题似乎对重新编写图像的alt标记的插件没有任何反应


谢谢大家!

无需更改WordPress核心文件:)

只需在主题中找到使用了“\u post\u缩略图”(函数的位置,然后将其更改为:

$title=get_the_title();
the_post_thumbnail( array(150, 150),array( 'alt' =>$title) );
用户850010

你完全正确

$title=get_the_title();
the_post_thumbnail( array(150, 150),array( 'alt' =>$title) );
这对你很有用,亚历克斯,请检查一下

Alex,如果你只想显示特定的图像,那么使用下面的代码

<img src="'.wp_get_attachment_url( get_post_thumbnail_id($item->ID)).'" alt="'.$item->post_title.'" title="'.$item->post_title.'" />
ID)).“alt=“”.$item->post\u title.“title=“”.$item->post\u title.”/>