WordPress技巧:为链接的XFN关系增加nofollow属性

 

 

 

我们来看下默认的链接关系是没有办法直接输入内容的,只能通过下面的选项来选择,但是所有的选项都没有nofollow属性,所以我们需要小小的修改一下,使得这里可以选择nofollow项目。

WordPress技巧:为链接的XFN关系增加nofollow属性

修改方法也很简单,xfn是在/wp-admin/meta-box.php里定义的。打开该文件,在836行左右找到类似以下代码:

<tr><thscope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity')?></th><td><fieldset><legendclass="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity')?></span></legend><labelfor="me">
	<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity','me');?> />
	<?php _e('another web address of mine')?></label></fieldset></td></tr>

在下面添加以下代码即可。

<tr><thscope="row">Nofollow</th><td><fieldset><legendclass="screen-reader-text"><span>nofollow</span></legend><labelfor="nofollow">
	<input class="valinp" type="checkbox" name="nofollow" value="nofollow" id="nofollow" <?php xfn_check('nofollow','nofollow');?> />
	nofollow</label></fieldset></td></tr>

好了,大功告成,看一下结果是否如下图所示这样了。

WordPress技巧:为链接的XFN关系增加nofollow属性

展开评论