From 5dd748cb53f8ef8427413d68203e1462d9389159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=AA=E5=AD=90?= Date: Mon, 29 Jul 2024 15:22:46 +0800 Subject: [PATCH] 0.5.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 是否在文章页面显示文章分类 --- functions.php | 6 +++++- post.php | 46 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/functions.php b/functions.php index 19f1b22..aebc015 100644 --- a/functions.php +++ b/functions.php @@ -9,7 +9,7 @@ function themeConfig($form) { $form->addInput($sticky); $showProfile = new Typecho_Widget_Helper_Form_Element_Radio('showProfile', array('0'=> _t('否'), '1'=> _t('是')), - '0', _t('是否在文章页面显示显示作者信息'), _t('选择“是”将在文章页面包含显示作者信息。')); + '0', _t('是否在文章页面显示作者信息'), _t('选择“是”将在文章页面包含显示作者信息。')); $form->addInput($showProfile); $instagramurl = new Typecho_Widget_Helper_Form_Element_Text('instagramurl', NULL, 'https://Instagram.com/', _t('Instagram'), _t('会在个人信息显示')); $form->addInput($instagramurl); @@ -37,6 +37,10 @@ function themeConfig($form) { $form->addInput($addhead); $tongji = new Typecho_Widget_Helper_Form_Element_Textarea('tongji', NULL, NULL, _t('统计代码'), _t('支持HTML')); $form->addInput($tongji); + $showcate = new Typecho_Widget_Helper_Form_Element_Radio('showcate', + array('0'=> _t('否'), '1'=> _t('是')), + '0', _t('是否在文章页面显示文章分类'), _t('选择“是”将在文章页面显示文章的分类信息。')); + $form->addInput($showcate); $showallwords = new Typecho_Widget_Helper_Form_Element_Radio('showallwords', array('0'=> _t('否'), '1'=> _t('是')), '0', _t('是否显示归档字数统计'), _t('选择“是”将在归档页面显示全站总字数。')); diff --git a/post.php b/post.php index b443fdf..be6a019 100644 --- a/post.php +++ b/post.php @@ -36,10 +36,11 @@ commentsNum('0 ', '1 ', '%d '); ?> user->hasLogin() && $this->user->pass('editor', true)): ?> - - - Edit + + + + + Edit

title() ?>

@@ -135,6 +136,43 @@ options->showProfile): ?> need('profile.php'); ?> + +options->showcate): ?> + categories) { + // 获取第一个分类的信息 + $category = $this->categories[0]; + $categoryId = $category['mid']; + $categoryName = $category['name']; + $categoryDescription = $category['description']; // 如果分类有说明(描述) + + // 获取主题选项中的分类图片基本 URL + $themeUrl = $this->options->midimg; + + // 生成分类图片地址 + $categoryImage = $themeUrl . $categoryId . '.jpg'; + } + ?> + + + +
+ +
+ <?php echo htmlspecialchars($categoryName); ?> +
+
+
+
+
+
+
+ + options->showrelated): ?> need('related.php'); ?>