如何为我的特色图片添加标题? 时间:2017-09-27 作者:mehdi 我想为我的特色图片添加标题,如何添加此项目:$attr = array( \'title\' => \'howdy partner\', \'alt\' => \'a nice view of the ocean\', ); // pick one, note 2 or 3 arguments: the_post_thumbnail( \'post-thumbnail\', $attr ); echo("<a href=\'$p->permalink\'>". // null for current $post->ID (use within loop) get_the_post_thumbnail( null, \'post-thumbnail\', $attr ). "</a>"); 我的网站是:https://abzarwp.com 1 个回复 SO网友:Mostafa Soufi 我不确定你的问题,但下面的代码更正确。$attr = array( \'title\' => get_the_title(), \'alt\' => \'a nice view of the ocean\', ); echo sprintf( \'<a href="%s">%s</a>\', get_the_permalink(), get_the_post_thumbnail( null, \'post-thumbnail\', $attr ) ); 结束 文章导航