From beba961edf5dbb4fceecc11c6542394d4b8168ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=AA=E5=AD=90?= Date: Wed, 5 Jun 2024 11:41:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E8=8E=B7=E5=8F=96cover?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- postlist.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/postlist.php b/postlist.php index 8392b66..4e949be 100644 --- a/postlist.php +++ b/postlist.php @@ -56,13 +56,19 @@ commentsNum('评论', '1 评论', '%d 评论'); ?> - content); ?> - - 文章图片 - + content); +// 检查自定义字段cover是否已设置 +$cover = $this->fields->cover; +// 如果自定义字段cover已设置,则优先使用 +// 如果没有设置,则显示文章的第一张图片 +$imageToDisplay = !empty($cover) ? $cover : $firstImage; +if($imageToDisplay): ?> + 文章图片 + - pagenav( '',