Changeset 8962
- Timestamp:
- 09/24/2008 04:45:50 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment-template.php
r8961 r8962 248 248 */ 249 249 function get_comment_class( $class = '', $comment_id = null, $post_id = null ) { 250 static $comment_alt;250 global $comment_alt, $comment_depth, $comment_thread_alt; 251 251 252 252 $comment = get_comment($comment_id); … … 270 270 if ( empty($comment_alt) ) 271 271 $comment_alt = 0; 272 if ( empty($comment_depth) ) 273 $comment_depth = 1; 274 if ( empty($comment_thread_alt) ) 275 $comment_thread_alt = 0; 272 276 273 277 if ( $comment_alt % 2 ) { … … 279 283 280 284 $comment_alt++; 285 286 // Alt for top-level comments 287 if ( 1 == $comment_depth ) { 288 if ( $comment_thread_alt % 2 ) { 289 $classes[] = 'thread-odd'; 290 $classes[] = 'thread-alt'; 291 } else { 292 $classes[] = 'thread-even'; 293 } 294 $comment_thread_alt++; 295 } 296 297 $classes[] = "depth-$comment_depth"; 281 298 282 299 if ( !empty($class) ) { … … 883 900 884 901 function start_lvl(&$output, $depth, $args) { 902 $GLOBALS['comment_depth'] = $depth + 1; 903 885 904 switch ( $args['style'] ) { 886 905 case 'div': … … 897 916 898 917 function end_lvl(&$output, $depth, $args) { 918 $GLOBALS['comment_depth'] = $depth + 1; 919 899 920 switch ( $args['style'] ) { 900 921 case 'div': … … 912 933 function start_el(&$output, $comment, $depth, $args) { 913 934 $depth++; 935 $GLOBALS['comment_depth'] = $depth; 914 936 915 937 if ( !empty($args['callback']) ) { … … 921 943 extract($args, EXTR_SKIP); 922 944 923 if ( 'div' == $args['style'] ) 945 if ( 'div' == $args['style'] ) { 924 946 $tag = 'div'; 925 else 947 $add_below = 'comment'; 948 } else { 926 949 $tag = 'li'; 950 $add_below = 'div-comment'; 951 } 927 952 ?> 928 953 <<?php echo $tag ?> <?php comment_class() ?> id="comment-<?php comment_ID() ?>"> … … 944 969 945 970 <div class='reply'> 946 <?php echo comment_reply_link(array('add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['depth'])) ?>971 <?php echo comment_reply_link(array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['depth'])) ?> 947 972 <?php if ( 'list' == $args['style'] ) : ?> 948 973 </div> … … 977 1002 */ 978 1003 function wp_list_comments($args = array(), $comments = null ) { 979 global $wp_query; 1004 global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt; 1005 1006 $comment_alt = $comment_thread_alt = 0; 1007 $comment_depth = 1; 980 1008 981 1009 $defaults = array('walker' => null, 'depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all',
Note: See TracChangeset
for help on using the changeset viewer.