set_post_thumbnail_size

函数
set_post_thumbnail_size ( $width = 0, $height = 0, $crop = false )
参数
  • (int) $width Image width in pixels.
    Required:
  • (int) $height Image height in pixels.
    Required:
  • (bool|array) $crop Optional. Whether to crop images to specified width and height or resize. An array can specify positioning of the crop area. Default false.
    Required:
    Default: false
相关
  • add_image_size()
定义位置
相关方法
set_post_thumbnailget_post_thumbnail_idthe_post_thumbnailhas_post_thumbnaildelete_post_thumbnail
引入
2.9.0
弃用
-

set_post_thumbnail_size: 这是一个WordPress的函数,用来设置当前文章的缩略图的大小。它通常用在主题的functions.php文件中,用于定制文章缩略图的大小: 这个函数需要两个参数:文章缩略图的宽度和高度。

为文章缩略图注册一个图像尺寸。

function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) {
	add_image_size( 'post-thumbnail', $width, $height, $crop );
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-14 10:36:29

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: