Wordpress-精确文本修剪功能
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Wordpress-精确文本修剪功能相关的知识,希望对你有一定的参考价值。
Add to your functions.php in the active template.Remove commented text. Fat/Thin char detection still not implemented. I'll update it as soon as I get some time. If you come with it please let me know :)
function pcsite_trim ($text, $maxwords, $allowtags = "") { // <?php echo pcsite_trim(get_the_content(), 15, ""); // Strip tags //workingonthis-$thinchars = ereg_replace("[^fijlt]", "", $text); //workingonthis-$fatchars = ereg_replace("[^mw]", "", $text); //workingonthis-$modifier = 5.1 + ( (strlen($thinchars) / strlen($text)) - (strlen($fatchars) / strlen($text)) ); $modifier = 5.1; // average letters per word (in normal english it's 4.5, but in blogging and so it increases) // Array to text $text = "<p>".$text."...</p>"; return $text; }
以上是关于Wordpress-精确文本修剪功能的主要内容,如果未能解决你的问题,请参考以下文章