2013-08-27 30 views
0

在我的WordPress安裝,我想顯示在主頁上簡短的文字後彙總(見所附圖片和文字以紅色突出顯示)顯示縮短後總結

該網頁包含的堆疊清單我最近的帖子(默認的)。其中

常用的兩種解決方案,我已經意識到:

解決方案#1 - 在「插入更多」標籤: - 我不希望有一個「更多」按鈕。我只需要擁有特色圖片,作者,類別以及縮短的帖子摘要。

解決方案#2 - 將「the_content」替換爲「the_excerpt」 - 我在index.php和archive.php中查找了「the_content」,但它似乎並不存在於這些文件中。它存在於blog.php中,但將其更改爲「the_excerpt」不起作用,創建帖子時無法選擇片段。

我的WP主題是提前Qreator responsive WP

感謝您的幫助!

+0

可能重複的[如何設置上\ _content()字符的限制,在WordPress中\ _excerpt()](http://stackoverflow.com/questions/3147898/how-到設定的字符限制 - 上的內容和最摘錄功能於WordPress的) – brasofilo

回答

1
<?php 
    add_filter("the_content", "plugin_myContentFilter"); 

    function plugin_myContentFilter($content) 
    { 
    // Take the existing content and return a subset of it 
    return substr($content, 0, 300); 
    } 
?> 

look here