1
我想讓我用的主題(DICE)拉入圖像的標題文本。WordPress主題不通過圖像的標題文本
我使用的代碼如下;
if (has_post_thumbnail()) {
if ($linking == 'lightbox') {
$alt = esc_attr(get_the_title($post->ID));
$the_title = esc_attr(get_the_title($post->ID));
$img = get_the_post_thumbnail($post->ID, $size, array('alt' => $alt, 'title' => $the_title));
}
else
$img = get_the_post_thumbnail($post->ID, $size);
}
elseif($placeholder) {
$img = btp_render_placeholder($size, '', false);
}
else {
return;
}
我已經加入的唯一線是
$the_title = esc_attr(get_the_title($post->ID));
與
'title' => $the_title
在陣列藏漢
。替代文字通過罰款,所以我不確定爲什麼標題文本不通過?
任何幫助表示讚賞。謝謝。