我正在使用Greg的线程化评论编号插件对评论进行编号。实际上,我在每个父注释旁边显示了一个数字(没有线程注释数字)。我已经尝试解决了两个问题,但都没有结果:
我正在用不同的布局显示顶部注释,我需要从#2开始编号。看起来很容易,但我没有找到修改插件代码的方法。
显示每个具有线程的注释的线程注释总数。
示例:
评论1
------------1.1
------------1.2
------------1.3
总线程注释数=3
评论2
------------2.1
------------2.2
总线程注释数=2
等
我已经在使用下面的代码来获取家长总数。我也可以得到子项,但它是总数,我需要显示每个注释子项的数量,如示例所示
$number_of_parents = c_parent_comment_counter($post->ID);
$number_of_children = $post->comment_count - $number_of_parents;
谢谢!
编辑:根据请求,这里是wp\\u list\\u comments回调函数。抱歉弄得一团糟,我不是程序员,工作完成后会清理代码:)
## Function: Basic Callback Function From WP Codex (http://codex.wordpress.org/Template_Tags/wp_list_comments), January 2009
function gtcn_basic_callback($comment, $args, $depth) {
// no changes here except that we have added in the call to gtcn_comment_numbering
$GLOBALS[\'comment\'] = $comment;
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<?php if( empty( $comment->comment_parent ) ) { //if the comment does not have a parent, then it is L1?>
<div class="linguetta-posizione"><?php echo gtcn_comment_numbering($comment->comment_ID, $args);
?></div>
<?php }
?>
<div id="comment-<?php comment_ID(); ?>">
<div class="comment-author vcard">
<div class="comment-barra-user">
<div class="comment-avatar">
<?php if( empty( $comment->comment_parent ) ) { ?><?php echo get_avatar($comment,$size=\'60\'); ?><?php } else { ?><?php echo get_avatar($comment,$size=\'30\'); ?><?php } ?></div>
<div class="comment-username"><?php printf((\'<cite class="fn">%s</cite> \'), get_comment_author_link()) ?><br class="clear"/>
<?php if( empty( $comment->comment_parent ) ) { ?><div id="comment-container-points">
<div class="comment-points"><img src="<?php bloginfo(\'template_url\'); ?>/images/ico-points.png" /><a>3333</a></div><div class="comment-level"><img src="<?php bloginfo(\'template_url\'); ?>/images/ico-level.png" /><a>livello</a></div>
</div> <?php } else { ?><?php } ?>
</div>
<?php if ( is_user_logged_in() ) { if( empty( $comment->comment_parent ) ) {?>
<div class="comment-votazione"><h2>Vota la risposta:</h2>
<?php { //if the comment does not have a parent, then it is L1
if(function_exists(ckrating_display_karma)) { ckrating_display_karma(); }
}
?> </div>
<?php }} else {
if( empty( $comment->comment_parent ) ) { ?>
<div class="comment-votazione"><h2>Registrati per votare</h2>
</div>
<?php }} ?>
</div><!-- end BARRA USER -->
<br class="clear"/>
</div>
<?php if ($comment->comment_approved == \'0\') : ?>
<em><?php _e(\'Your comment is awaiting moderation.\') ?></em>
<br />
<?php endif; ?>
<?php comment_text() ?>
<div class="reply">
<?php comment_reply_link(array_merge( $args, array(\'reply_text\' => \'COMMENTA LA RISPOSTA\', \'depth\' => $depth, \'max_depth\' => $args[\'max_depth\']))) ?>
</div><div class="comment-meta commentmetadata"><?php if( empty( $comment->comment_parent ) ) { ?>Risposta inserita<?php } else { ?> Commento inserito <?php } ?>
<?php echo time_ago_comment(); ?><?php edit_comment_link((\'- modifica\'),\' \',\'\') ?></div>
</div></li>
<?php
} // end basic callback function