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

ximagine
ximagine
ximagine
2023年8月16日17:49:3925
0
 1 467字阅读1分33秒沉浸阅读
宝藏摘要

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

荒岛广告位 火热招商中 详情请咨询 荒岛客服号 Q10907252
WordPress 评论回复添加 @ 显示效果 WP 主题优化增强 function 文件实用功能代码段
宝藏归属:教程  怎么办 发表观点:前往评论 浏览次数:25 次 更新时间:2023年8月16日 19:08:59

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

// 荒岛一座藏有宝藏的小岛
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
请按 Ctrl+D 收藏荒岛分享给好友 如您发现本文件已经失效无法下载请联系站长修正
  • 荒岛公众号
  • 扫一扫关注
  • weinxin
  • 荒岛小程序
  • 扫一扫关注
  • weinxin
荒岛广告位 火热招商中 详情请咨询 荒岛客服号 Q10907252
荒岛广告位 火热招商中 详情请咨询 荒岛客服号 Q10907252

发表评论