方法一
效果
如何只在主頁只顯示一部分摘要而不顯示全文的方法
1.
首先在管理員控制台中在設置里邊改成
勾選僅輸出摘要
2.
在寫文章之后在編寫文章時在摘要和全文中間使用分隔符
<!--more-->
例如
[文章摘要BALABALA……]
<!--more--> [文章正文BALABALA……]
這樣在首頁顯示的時候只會顯示摘要了
方法二
在當前主題的 index.php 文件中找到代碼
<?php
$this
->content(
'閱讀剩余部分...'
); ?>
|
將其替換為
<?php
$this
->excerpt(); ?>
|
如果要按制摘要的輸出字數,可以修改代碼為100
<?php
$this
->excerpt(100,
'...'
); ?>
|
方法三
、
登錄到后台-控制台-外觀-編輯當前外觀:
編輯文件 archive.php
編輯文件 index.php
修改兩處分別找到:
/ 默認顯示的是全文 /
<?php $this->content('- 閱讀剩余部分 -'); ?>
替換成(概要取300字):
/ 自定義輸出,如 300個字符 /
<?php $this->excerpt(300,'- 閱讀剩余部分 -'); ?>
修改typecho首頁顯示文章的數量:
編輯文件 functions.php
在末尾添加:
/* 自定義首頁文章分布數量,如 10 */ function themeInit($archive) { if ($archive->is('index')) { $archive->parameter->pageSize = 10; } }
