纵横比的基本检查。显示为横向、方形或纵向
if ( !has_post_thumbnail()) {
return \'Error\';
} else {
$image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), \'\');
$image_w = $image[1];
$image_h = $image[2];
if ($image_w > $image_h) {
echo \'landscape\';
}
elseif ($image_w == $image_h) {
echo \'square\';
}
else {
echo \'portrait\';
}
}