我正在使用此代碼將300個字符的限制設置爲the_content。設置the_content字符的限制
我如何設置當我想要使用它,當我不?
<?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);
}
?>
在什麼條件下你想使用它,在什麼不是?無論如何,圍繞'add_filer()'的一個簡單的'if()'語句就可以做到。 –
此代碼位於我的functions.php中,每當我使用the_content()時,它只顯示前300個字符。 但在一些地方,我想顯示the_content() – Osmar
的整個內容我從最初的問題得到的。 **你的意思是什麼**「地點」 - 某些郵政類別,特定頁面等。 –