以下是我的评论栏:
<div id="comments">
<?php if (have_comments()) : ?>
<h3><?php printf(_n(\'1 comment\', \'%1$s comments\', get_comments_number()), number_format_i18n( get_comments_number() ), \'\' ); ?></h3>
<div class="comment_list">
<?php $comments_by_type = &separate_comments($comments); ?>
<?php if ( !empty($comments_by_type[\'comment\']) ) : ?>
<ol>
<?php wp_list_comments(array(\'callback\' => \'commentslist\', \'type\' => \'comment\')); ?>
</ol>
<?php endif; ?>
<?php if ( ! empty($comments_by_type[\'pings\']) ) : ?>
<h3 id="pings">Pingbacks/Trackbacks</h3>
<ol class="pinglist">
<?php wp_list_comments(array(\'callback\' => \'commentslist\', \'type\' => \'pings\')); ?>
</ol>
<?php endif; ?>
</div>
<?php endif; // end have_comments() ?>
</div>
这是我的
wp_list_comments
回调:
function commentslist($comment, $args, $depth) {
$GLOBALS[\'comment\'] = $comment;
require_once(ABSPATH . WPINC . \'/registration.php\');
if ($comment->user_id || email_exists($comment->comment_author_email)){
//comment by registered user
$avatar = \'/images/bird_comments_big.png\';
}else{
//comment by none registered user
$avatar = \'/images/bird_comments_pink.png\';
}
?>
<li>
<div id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
<table>
<tr>
<td>
<?php echo get_avatar($comment, 70, get_bloginfo(\'template_url\').$avatar); ?>
</td>
<td>
<div class="comment-meta">
<?php printf(__(\'<p class="comment-author"><span>%s</span> says:</p>\'), get_comment_author_link()) ?>
<?php printf(__(\'<p class="comment-date">%s</p>\'), get_comment_date(\'M j, Y\')) ?>
<?php comment_reply_link(array_merge($args, array(\'depth\' => $depth, \'max_depth\' => $args[\'max_depth\']))) ?>
</div>
</td>
<td>
<div class="comment-text">
<?php if ($comment->comment_approved == \'0\') : ?>
<p><?php _e(\'Your comment is awaiting moderation.\') ?></p>
<br/>
<?php endif; ?>
<?php comment_text() ?>
</div>
</td>
</tr>
</table>
</div>
<?php
}
由于缺少ping的电子邮件地址,wp\\u gravatar似乎应该调用未注册的用户映像,但它没有返回任何内容。