WordPress SEO 优化插件:Platinum SEO修正版

很多人都称Platinum SEOAll in one SEO pack的接班人。因为这个插件拥有All-in-one-SEO-pack的所有能力,并在此之上还新增了许多后者不具备的功能。其实Platinum SEO只是All in one SEO pack的修改版,并且完美继承了了All in one SEO pack对中文支持的bug。

使用Platinum SEO几个月了,今天查看源文件。却发现很多文章的Description并没有自动生成,就算有的,也只抓了几个字。于是使用修正All in one SEO pack中文bug的方式尝试修改。

找到

trim_excerpt_without_filters($text)

函数,将其整体改为:

function trim_excerpt_without_filters($text) {
$text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text);
$max = $this->max_description_length;
if ($max < strlen($text)) {
while($text[$max] != ' ' && $text[$max] != '\n' && $max > $this->min_description_length) {
$max--;
}
}
if($max == $this->min_description_length) {
$max = $this->max_description_length;
}
if($text[$max - 1] == '\r') {
$max--;
}
if(ord($text[$max]) > 0x7F && ord($text[$max]) < 0xC0)
{
while(ord($text[$max]) <= 0xC0)
$max--;
}
$text = substr($text, 0, $max);
return trim(stripcslashes($text));
}

 

然后修改

$max_description_length

$min_description_length

设置,要注意的是,一般来说META Description信息在100~150字最佳,然而插件默认设置的160是针对英文来说的。自己根据需要修改就可以了。

最后修改的是

if (isset($description) && (strlen($description) > $this->min_description_length) && !(is_home() && is_paged())) {

把它修改为

if (isset($description) && (strlen($description) >= $this->min_description_length) && !(is_home() && is_paged())) {

 

如果你觉得修改插件很麻烦。那么提供一个简单的方法,请查看后便链接里的文章。all in one seo pack的description沒有產生

提供已经修改好了的Platinum SEO最新版插件下载:

http://www.uudisc.com/user/qinmenghua/file/1408110

另外还推荐个适合中文用户使用的SEO插件:WordPress中文SEO插件

PS:使用此修改版插件有任何疑问,请资讯其他高手,本人菜鸟一个。本地测试20多篇文章均能正常自动生成Description信息。

WordPress SEO 优化插件:Platinum SEO修正版》上有1个想法

发表回复