WordPress 摘要字數控制

2021-05-09 16:26:58 字數 352 閱讀 2130

共有兩種方法:

1. 修改對應主題的index.php(或者home.php)檔案中的**

the_content(__('read more...', 'inove')); ?>

the_content為獲取文章全部內容的api。

function wp_trim_excerpt($text)

add_filter('the_excerpt', 'mul_excerpt');

add_filter('the_excerpt_rss', 'mul_excerpt');

預設為255個字元,我把他改為了255*3。 顯示效果就是現在的樣子啦。當然你可以根據你的需要進行合適的修改。

wordpress設定主頁顯示摘要及字數

說明 本人使用的wordpress主題是twentysixteen,其它主題應該類似。首先,開啟functions.php檔案,把下面的 放到末尾。display the content in short words function dm strimwidth str start width tr...

WordPress的摘要顯示方式

wordpress的後台有摘要顯示的欄目,如果沒有顯示,需要設定一下,如圖 在列表頁現實的內容的時候,一般是有摘要的顯示摘要,沒有摘要的擷取文章的前一部分文字。如下 has excerpt the excerpt else echo mb strimwidth strip tags post pos...

修改織夢自動摘要字數

版本 織夢5.7正式版 目的 將織夢預設的自動摘要字數 250 修改成自定義的字數 2048 1.開啟dede article edit.php找到第113行 將其 description cn substrr description,250 改成 description cn substrr de...