From 76317320c58d6c5a859dbf9e8c8d0d1ca06053dc Mon Sep 17 00:00:00 2001
From: Eltrac <45323514+BigCoke233@users.noreply.github.com>
Date: Wed, 17 Jul 2019 13:28:56 +0800
Subject: =?UTF-8?q?=E6=96=87=E7=AB=A0=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A?=
=?UTF-8?q?=E4=B9=89=E6=91=98=E8=A6=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
functions.php | 5 ++++-
index.php | 9 ++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/functions.php b/functions.php
index aff2db6..113a1ab 100644
--- a/functions.php
+++ b/functions.php
@@ -82,6 +82,9 @@ function themeConfig($form) {
* 文章与独立页自定义字段
*/
function themeFields(Typecho_Widget_Helper_Layout $layout) {
- $banner = new Typecho_Widget_Helper_Form_Element_Text('banner', NULL, NULL,_t('缩略图'), _t('输入一个图片 url,作为缩略图显示在文章列表,没有则不显示'));
+ $banner = new Typecho_Widget_Helper_Form_Element_Text('banner', NULL, NULL,_t('文章头图'), _t('输入一个图片 url,作为缩略图显示在文章列表,没有则不显示'));
$layout->addItem($banner);
+
+ $excerpt = new Typecho_Widget_Helper_Form_Element_Text('excerpt', NULL, NULL,_t('文章摘要'), _t('输入一段文本来自定义摘要,如果为空则自动提取文章前 130 字。'));
+ $layout->addItem($excerpt);
}
\ No newline at end of file
diff --git a/index.php b/index.php
index 8c21025..2db75f8 100644
--- a/index.php
+++ b/index.php
@@ -31,7 +31,14 @@ $this->need('includes/header.php');
sticky(); ?>title(); ?>
-
excerpt(); ?>
++ fields->excerpt && $this->fields->excerpt!='') { + echo $this->fields->excerpt; + }else{ + echo $this->excerpt(130); + } + ?> +
-- cgit v1.2.3