Typecho 评论者链接新窗口打开

方法一

functions.php

function CommentAuthor($obj, $autoLink = NULL, $noFollow = NULL) {    //后两个参数是原生函数自带的,为了保持原生属性,我并没有删除,原版保留
    $options = Helper::options();
    $autoLink = $autoLink ? $autoLink : $options->commentsShowUrl;    //原生参数,控制输出链接
    $noFollow = $noFollow ? $noFollow : $options->commentsUrlNofollow;    //原生参数,控制输出链接额外属性
    if ($obj->url && $autoLink) {
        echo '<a href="'.$obj->url.'"'.($noFollow ? ' rel="external nofollow"' : NULL).(strstr($obj->url, $options->index) == $obj->url ? NULL : ' target="_blank"').'>'.$obj->author.'</a>';
    } else {
        echo $obj->author;
    }
}

comments.php

替换 $comments->author()CommentAuthor($comments)

方法二

comments.php 修改添加:

function threadedComments($comments, $options) {
   ......

    if ($comments->url) {
        $author = '<a href="' . $comments->url . '" target="_blank"' . ' rel="external nofollow">' . $comments->author . '</a>';
    } else {
        $author = $comments->author;
    }

    ......

替换 $comments->author()echo $author

换色
阅读
登录
扫码