WordPress给博客友情链接添加属性

顾陌 发布时间:2014-09-06 分类:Web 阅读:4558次 2 条评论

WordPress 3.9版本。默认没有友情链接管理,需要安装插件LinkManage。

插件安装后需要修改XFN关系,并没有"external"和"nofollow"这两个属性(外连接及不传递权重),或者添加其他属性。

在WordPress 3.9版本中的meta-boxes.php的第917行添加如下代码即可实现"external"和"nofollow"这两个属性的管理。

添加的内容:

    <!--添加跟踪或者不跟踪-->
    <tr>
        <th scope="row"> <?php _e('外站链接') ?> </th>
        <td>
        <label for="external">
        <input class="valinp" type="checkbox" name="external" value="external" id="external" <?php xfn_check('external', 'external'); ?> />
        <?php _e('external') ?></label>
        </td>
    </tr>
    <tr>
        <th scope="row"> <?php _e('允许跟踪') ?> </th>
        <td>
        <label for="follow">
        <input class="valinp" type="checkbox" name="follow" value="nofollow" id="nofollow" <?php xfn_check('follow', 'nofollow'); ?> />
        <?php _e('nofollow') ?></label>
        </td>
    </tr>

给wp_list_bookmarks分类的链接名称添加链接a标签

文件地址:wp-includes/bookmark-template.php

添加一行:$cat_term_id = apply_filters( 'link_category', $cat->term_id );

将$output .= "$title_before$catname$title_after\n\t<ul class='xoxo blogroll'>\n";

修改为:$output .= "$title_before<a href='".home_url( '/' )."index.php/pagelink-$cat_term_id.html'>$catname</a>$title_after\n\t<ul class='xoxo blogroll'>\n";


已有2条留言
  • boke123网址大全
    发布于 2014-09-17 09:26:37  回复该评论
  • 好像wordpress也有友链管理的,只是隐藏起来而已,把它显示出来就可以了。

发表评论:

◎欢迎您的参与讨论。