Wordpress 链接的XFN关系增加nofollow属性
今天查询站点的友链情况的时候发现[我的推荐]栏目下的链接并没有加上nofollow属性,该栏目主要存放的是一些有价值的博客,属于tiandi发起的单向友链,所以可以加上nofollow属性以免蜘蛛爬行出去。
我们来看下默认的链接关系是没有办法直接输入内容的,只能通过下面的选项来选择,但是所有的选项都没有nofollow属性,所以我们需要小小的修改一下,使得这里可以选择nofollow项目.
修改方法也很简单,xfn是在/wp-admin/meta-box.php里定义的,打开该文件,在836行左右找到类似以下代码:
<tr> <th scope= "row" ><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'identity' ) ?></th> <td><fieldset><legend class = "screen-reader-text" ><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'identity' ) ?></span></legend> <label for = "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> <th scope= "row" >Nofollow</th> <td><fieldset><legend class = "screen-reader-text" ><span>nofollow</span></legend> <label for = "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属性 - WordPress的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did8566