增加判断是否在文章页面显示作者信息

This commit is contained in:
浪子 2024-05-17 18:42:35 +08:00
parent 965dd0fc7f
commit b221c3d9ab
9 changed files with 12 additions and 27 deletions

View File

@ -26,15 +26,11 @@ function themeConfig($form) {
$form->addInput($addhead); $form->addInput($addhead);
$tongji = new Typecho_Widget_Helper_Form_Element_Textarea('tongji', NULL, NULL, _t('统计代码')); $tongji = new Typecho_Widget_Helper_Form_Element_Textarea('tongji', NULL, NULL, _t('统计代码'));
$form->addInput($tongji); $form->addInput($tongji);
} $showProfile = new Typecho_Widget_Helper_Form_Element_Radio('showProfile',
function themeFields($layout) { array('0'=> _t('否'), '1'=> _t('是')),
$switchpf = new Typecho_Widget_Helper_Form_Element_Checkbox('switchpf', '0', _t('是否在文章页面显示显示作者信息'), _t('选择“是”将在文章页面包含显示作者信息。'));
array('open'=>'显示作者'), $form->addInput($showProfile);
NULL, }
_t('是否文章页面显示作者信息'),
_t('勾选后,将在文章页面显示'));
$layout->addItem($switchpf);
}
function get_post_view($archive) { function get_post_view($archive) {
$cid = $archive->cid; $cid = $archive->cid;
$db = Typecho_Db::get(); $db = Typecho_Db::get();

View File

@ -20,7 +20,6 @@ error_reporting(E_ALL);if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<link rel='icon' href='<?php $this->options->icoUrl() ?>' type='image/x-icon' /> <link rel='icon' href='<?php $this->options->icoUrl() ?>' type='image/x-icon' />
<?php endif; ?> <?php endif; ?>
<?php $this->header("generator=&template=&pingback=&wlw=&xmlrpc=&rss1=&atom=&rss2=/feed"); ?> <?php $this->header("generator=&template=&pingback=&wlw=&xmlrpc=&rss1=&atom=&rss2=/feed"); ?>
<?php $this->options->addhead(); ?> <?php $this->options->addhead(); ?>
</head> </head>
<body> <body>

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* 关于页面 * 无评论页面
* *
* @package custom * @package custom
*/ */
@ -10,8 +10,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<header class="archive--header"> <header class="archive--header">
<h1 class="post--single__title"><?php $this->title() ?></h1> <h1 class="post--single__title"><?php $this->title() ?></h1>
</header> </header>
<article class="post--single"> <article class="post--single">
<div class="graph u-marginBottom30"> <div class="graph u-marginBottom30">
<?php $this->content(); ?> <?php $this->content(); ?>
</div> </div>

View File

@ -12,9 +12,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php Typecho_Widget::widget('Widget_Stat')->to($quantity); ?> <?php Typecho_Widget::widget('Widget_Stat')->to($quantity); ?>
<h2 class="archive--title__year">共包含 <?php $quantity->publishedPostsNum(); ?> 篇文章</h2> <h2 class="archive--title__year">共包含 <?php $quantity->publishedPostsNum(); ?> 篇文章</h2>
</header> </header>
<div data-target="<?php $this->options->postLinkOpen(); ?>" class="page--archive" > <div data-target="<?php $this->options->postLinkOpen(); ?>" class="page--archive" >
<?php <?php
$stat = Typecho_Widget::widget('Widget_Stat'); $stat = Typecho_Widget::widget('Widget_Stat');
Typecho_Widget::widget('Widget_Contents_Post_Recent', 'pageSize=' . $stat->publishedPostsNum)->to($archives); Typecho_Widget::widget('Widget_Contents_Post_Recent', 'pageSize=' . $stat->publishedPostsNum)->to($archives);
@ -44,8 +42,6 @@ $output .= '<li class="archive--item"><div class="archive--title"><a href="' . $
$output .= ' </ul></div></div>'; $output .= ' </ul></div></div>';
echo $output;?> echo $output;?>
</div> </div>
</main> </main>
<?php $this->need('footer.php'); ?> <?php $this->need('footer.php'); ?>

View File

@ -24,5 +24,4 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
'); ?> '); ?>
</section> </section>
</div> </div>
<?php $this->need('footer.php'); ?> <?php $this->need('footer.php'); ?>

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* 豆瓣 * 豆瓣页面
* *
* @package custom * @package custom
*/ */

View File

@ -23,11 +23,8 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
?> ?>
</ul> </ul>
</div> </div>
<?php if ($this->allow('comment')): ?> <?php if ($this->allow('comment')): ?>
<?php $this->need('comments.php'); ?> <?php $this->need('comments.php'); ?>
<?php endif; ?> <?php endif; ?>
</section> </section>
<?php $this->need('footer.php'); ?> <?php $this->need('footer.php'); ?>

View File

@ -8,8 +8,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('header.php'); ?> <?php $this->need('header.php'); ?>
<section class="site--main"> <section class="site--main">
<header class="archive--header"> <header class="archive--header">
<h1 class="post--single__title"><?php $this->title() ?></h1> <h1 class="post--single__title"><?php $this->title() ?></h1>
</header> </header>
<div class="post-content"> <div class="post-content">
<?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0')->to($tags); ?> <?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0')->to($tags); ?>

View File

@ -60,9 +60,9 @@
<?php $this->tags(' ', true, ' '); ?> <?php $this->tags(' ', true, ' '); ?>
</div> </div>
<!-- 个人信息--> <!-- 个人信息-->
<?php if($this->fields->switchpf && in_array('open', $this->fields->switchpf)): ?> <?php if ($this->options->showProfile): ?>
<?php $this->need('profile.php'); ?> <?php $this->need('profile.php'); ?>
<?php endif; ?> <?php endif; ?>
<!--翻页--> <!--翻页-->
<nav class="navigation post-navigation is-active"> <nav class="navigation post-navigation is-active">
<div class="nav-links"> <div class="nav-links">