Typecho 博客首页文章显示日期和作者教程
在 Typecho 中,显示首页文章的日期和作者需要在主题模板中进行设置。具体步骤如下:
- 找到主题的首页模板文件 index.php,一般在主题文件夹的根目录下。
- 在模板文件中找到显示文章标题、摘要和阅读全文链接的代码,一般是类似下面的代码:
- 在这段代码的下面添加显示日期和作者的代码,如下所示:
- 保存文件并刷新网站查看效果。
<h2 class='post-title'><a href='<?php $this->permalink() ?>'><?php $this->title() ?></a></h2>
<p class='post-excerpt'><?php $this->excerpt(150, '...'); ?></p>
<p><a href='<?php $this->permalink() ?>' class='read-more'><?php _e('阅读全文'); ?> »</a></p>
<p class='post-meta'>
<span class='post-date'><?php $this->date('F j, Y'); ?></span>
<span class='post-author'><?php _e('作者:'); ?><?php $this->author(); ?></span>
</p>
其中,$this->date('F j, Y')表示以“月份 日,年份”的格式显示文章发布日期,$this->author()表示显示文章作者名字。
原文地址: https://www.cveoy.top/t/topic/ocCh 著作权归作者所有。请勿转载和采集!