我找到了方法!不使用该函数,可以添加查询和另一个函数。这是页面中的代码。php文件。
<?php $subs = new WP_Query( array( \'post_parent\' => $post->ID, \'post_type\' => \'page\', \'meta_key\' => \'_thumbnail_id\' ));
if( $subs->have_posts() ) : while( $subs->have_posts() ) : $subs->the_post();
echo \'<div class="re-featured-image child-thumb">\' . get_the_post_thumbnail($post->ID, \'index-thumb\', array(\'class\' => \'img-responsive\', \'id\' => \'img-center\'));
echo \'<div class="re-featured-image-title">\' . get_post(get_post_thumbnail_id($post->ID))->post_title . \'</div>\';
echo \'<div class="re-featured-image-caption">\' . get_post(get_post_thumbnail_id($post->ID))->post_excerpt . \'</div>\';
echo \'<div class="re-featured-image-description">\' . get_post(get_post_thumbnail_id($post->ID))->post_content . \'</div></div>\';
endwhile; endif; wp_reset_postdata(); ?>
如果希望缩略图链接到其页面,请在函数中添加此函数。php文件。我在这里找到了密码
http://wordpress.org/support/topic/making-post-thumbnail-link-to-postadd_filter( \'post_thumbnail_html\', \'my_post_image_html\', 10, 3 );
function my_post_image_html( $html, $post_id, $post_image_id ) {
$html = \'<a href="\' . get_permalink( $post_id ) . \'" title="\' . esc_attr( get_post_field( \'post_title\', $post_id ) ) . \'">\' . $html . \'</a>\';
return $html;
}