如果评论作者是注册用户,此功能将用评论作者的个人资料页替换评论作者的链接。否则,将显示标准WordPress commentauthor链接。
此函数不是我的,并且has been found googling.
function graphene_comment_author_profile_link(){
/* Get the comment author information */
global $comment;
$comment_ID = $comment->user_id;
$author = get_comment_author( $comment_ID );
$url = get_comment_author_url( $comment_ID );
/* Return the default WordPress comment author link if comment author is not
a registered user */
if ($comment_ID == 0){
if ( empty( $url ) || \'http://\' == $url )
$return = $author;
else
$return = "<a href=\'$url\' rel=\'external nofollow\' class=\'url\'>$author</a>";
} else {
/* Return the link to the comment author\'s profile age if otherwise */
$return = \'<a href="\'.home_url().\'/?author=\'.$comment_ID.\'">\'.$author.\'</a>\';
}
return $return;
}
add_filter(\'get_comment_author_link\', \'graphene_comment_author_profile_link\');