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">&nbsp;&nbsp; 
<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>
		

  

posted @ 2013-06-25 17:38  hurner  Views(406)  Comments(0Edit  收藏  举报