文章最后更新时间:
实用功能,本文来自转载,在此记录一下,免得以后找不到
修改 comments.php 文件
文件位置 wp-content/themes/zibll/template/comments.php
搜索 邮箱
找到评论区填写框位置,代码添加位置如图所示。
$o_t1 = $require_name_email ? '(可不填)' : '';
//评论区的网址填写框
echo '<li class="line-form">';
echo '<input type="text" name="url" class="line-form-input" tabindex="3" value="' . esc_attr($comment_author_url) . '" placeholder="">';
echo '<div class="scale-placeholder">网址' . $o_t1 . '</div>';
echo '<div class="abs-right muted-color"><i class="fa fa-fw fa-sitemap"></i></div>';
echo '<i class="line-form-line"></i>';
echo '</li>';
![图片[1]-子比主题添加评论链接填写框[已实装]-淇云博客-专注于IT技术分享](https://tc.pengqi.club/i/2025/08/25/68ac17747ef2e.png)
修改 zib-comments-list.php 文件
文件位置 /wp-content/themes/zibll/inc/functions/zib-comments-list.php
找到 zib_get_comments_user_name
函数,修改为以下内容。
// 初始化用户名称(用户或访客)
$user_name = $user_name ? $user_name : '<b class="mr6">' . $comment->comment_author . '</b>';
// 新增:处理评论作者URL和作者标签
$author_url = get_comment_author_url($comment->comment_ID);
if (!empty($author_url) && $author_url !== 'http://' && $author_url !== 'https://') {
// 如果存在作者URL,添加外部链接
$user_name = '<a target="_blank" href="' . esc_url($author_url) . '">' . $user_name . '</a>';
}
![图片[2]-子比主题添加评论链接填写框[已实装]-淇云博客-专注于IT技术分享](https://tc.pengqi.club/i/2025/08/25/68ac17f87b639.png)
暂无评论内容