WordPress 评论回复添加 @ 显示效果 WP 主题优化增强 function 文件实用功能代码段

ximagine
ximagine
管理
2014
文章
0
粉丝
教程 怎么办评论321字数 181阅读0分36秒阅读模式
宝藏摘要有时候荒岛用户之间会有一些互动,互相回复,尽管我的荒岛开启了嵌套评论,有时候评论者到底回复给谁还不是那么直观,不写入数据库只在前台评论列表显示 @ 评论者 ,荒岛本次带来 Word...
荒岛广告位招商进行中...
WordPress 评论回复添加 @ 显示效果 WP 主题优化增强 function 文件实用功能代码段
日期:2023年8月16日 分类:教程  怎么办 评论:发表评论 浏览:32

有时候荒岛用户之间会有一些互动,互相回复,尽管我的荒岛开启了嵌套评论,有时候评论者到底回复给谁还不是那么直观,不写入数据库只在前台评论列表显示 @ 评论者 ,荒岛本次带来 WordPress 评论回复添加 @ 显示效果的教程,只要将下面的代码添加到主题的「functions.php」文件即可。

// 荒岛一座藏有宝藏的小岛
function comment_at( $comment_text, $comment = '') {
	global $comment;
	if( @$comment->comment_parent > 0) {
		$comment_text = '<span class="at">@ <a href="#comment-' . $comment->comment_parent . '">'.get_comment_author( $comment->comment_parent ) . '</a></span> ' . $comment_text;
	}
	return $comment_text;
}
add_filter( 'comment_text' , 'comment_at', 20, 2);
宝藏内容来自荒岛-https://x-imagine.com/wordpress-comment-reply-add.html宝藏内容来自荒岛-https://x-imagine.com/wordpress-comment-reply-add.html

请按 Ctrl+D 收藏荒岛分享给好友 如您发现本文件已经失效无法下载请联系站长修正

荒岛公众号
扫一扫关注
weinxin
HDsoft27
公众号ID已复制,前往微信关注...
荒岛小程序
扫一扫关注
weinxin
ximagine
哔哩姬ID已复制,前往B站关注...
荒岛广告位招商进行中...
 
荒岛广告位招商进行中...

发表评论