将此函数添加到函数中。php文件:
function show($size = NULL) {
global $post;
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
if(isset($size)){
$image_data_array = wp_get_attachment_image_src($post_thumbnail_id,$size);
}else{
$image_data_array = wp_get_attachment_image_src($post_thumbnail_id);//Default value: \'thumbnail\'
}
echo $image_data_array[1]."x".$image_data_array[2];//here you can add more chars of strings if you want
}
使用方法如下:
<a class="classname" href="<?php the_post_thumbnail_url( \'full\' ); ?>">Full Image <?php show(\'full\'); ?></a>
这是输出
WidthxHeight
, 您可以使用任何默认图像大小
thumbnail, medium, medium_large, large, full
或使用添加的任何自定义大小
add_image_size()