【发布时间】:2014-07-03 13:50:10
【问题描述】:
我正在尝试将我正在使用的主题 (DICE) 用于提取图像的标题文本。
我使用的代码如下;
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
也在数组中。替代文字很好,所以我不确定为什么标题文字没有通过?
感谢任何帮助。谢谢。
【问题讨论】:
标签: php arrays wordpress text title