wordpres 自定义comment样式
http://wange.im/diy-wordpress-comment-style.html
function mytheme_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <article> <div class="cell hoverable reply" id="comment-<?php comment_ID(); ?>"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody><tr> <td valign="top" width="48"> <a href="http://forum.tianming.me/index.php/user/info/2" class="profile_link" title="hurner"> <img alt="hurner medium avatar" class="medium_avatar" src="http://forum.tianming.me/uploads/avatar/default.jpg"> </a> </td> <td width="10"></td> <td valign="top" width="auto"> <div class="fr"> <small class="snow"> #3 - 4 天前 <a href="#reply" onclick="replyOne('hurner');"><img align="absmiddle" alt="Reply_button" border="0" id="mention_button" class="clickable mention_button" data-mention="hurner" src="http://forum.tianming.me/static/images/reply_button.png"></a> <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?> </small> </div> <a href="http://forum.tianming.me/index.php/user/info/2" class="dark startbbs profile_link" title="hurner">hurner</a> <span class="snow"> <div class="sep5"></div> <div class="content reply_content"><?php comment_text() ?></div> </span></td> </tr> </tbody></table> </div> </article> <?php }
如下调用:
<?php //Gather comments for a specific page/post $comments = get_comments(array( 'post_id' => $post->ID, 'status' => 'approve' //Change this to the type of comments to be displayed )); //Display the list of comments wp_list_comments(array( 'per_page' => 10, //Allow comment pagination 'reverse_top_level' => false, //Show the latest comments at the top of the list 'callback'=> 'mytheme_comment', ), $comments); ?>
原始的评论输入框,如下comment_reply_link使用:
<div class = "commen-form" > <?php $args = array ( 'id_form' => 'commentform' , ); comment_form( $args ); ?> </div> |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?