2011-11-26 56 views
0

我寫功能的functions.php這樣問題在functions.php中添加函數[WordPress的]

function out() { 
    $s = 'End of the post, thanks for reading'; 
    return $s; 
} 

add_filter('the_content','out'); 

,我預計這將在帖子的末尾被取出後,進入的內容。但它所做的只是發佈帖子(什麼是the_content輸出)沒有顯示,我只會得到'帖子結束,感謝閱讀'。

我在做什麼錯?

回答

1

試試這個:

function out($content) { 
    return $content." End of the post, thanks for reading"; 
} 

add_filter('the_content', 'out'); 
+0

感謝的人工作的。所以我需要每次將參數傳遞給函數?和返回相同的參數? – zack

+0

看看這個網頁:http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content – Cyclonecode

1

你可以試試這個

function out($content) { 
    $content .= '<br>End of the post, thanks for reading'; 
    return $content; 
} 

add_filter('the_content','out'); 
相關問題