谁能帮我弄清楚为什么我的 wordpress 模板似乎不再显示评论?一旦我第一次处理模板代码,它就起作用了,但现在,几年后它不再起作用了。也许一些重要的事情发生了变化?!
同时 wp_list_comments();仍然有效
<?php wp_list_comments( array( 'callback' => 'bavotasan_comment' ) ); ?>
不再工作了。
这是我的functions.php
if ( ! function_exists( 'bavotasan_comment' ) ) :
/**
* Callback function for comments
*
* Referenced via wp_list_comments() in comments.php.
*
* @uses get_avatar()
* @uses get_comment_author_link()
* @uses get_comment_date()
* @uses get_comment_time()
* @uses edit_comment_link()
* @uses comment_text()
* @uses comments_open()
* @uses comment_reply_link()
*
* @since 1.0.0
*/
function bavotasan_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case '' :
?>
<li <?php comment_class(); ?>>
<div id="comment-<?php comment_ID(); ?>" class="comment-body">
<div class="comment-avatar">
<?php echo get_avatar( $comment, 60 ); ?>
</div>
<div class="comment-content">
<div class="comment-author">
<?php echo get_comment_author_link() . ' '; ?>
</div>
<div class="comment-meta">
<?php
printf( __( '%1$s at %2$s', 'ward' ), get_comment_date(), get_comment_time() );
edit_comment_link( __( '(edit)', 'ward' ), ' ', '' );
?>
</div>
<div class="comment-text">
<?php if ( '0' == $comment->comment_approved ) { echo '<em>' . __( 'Your comment is awaiting moderation.', 'ward' ) . '</em>'; } ?>
<?php comment_text() ?>
</div>
<?php if ( $args['max_depth'] != $depth && comments_open() && 'pingback' != $comment->comment_type ) { ?>
<div class="reply">
<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
</div>
<?php } ?>
</div>
</div>
<?php
break;
case 'pingback' :
case 'trackback' :
?>
<li id="comment-<?php comment_ID(); ?>" class="pingback">
<div class="comment-body">
<i class="icon-paper-clip"></i>
<?php _e( 'Pingback:', 'ward' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(edit)', 'ward' ), ' ' ); ?>
</div>
<?php
break;
endswitch;
}
endif; // bavotasan_comment