Ticket #14041: has_children.diff
File has_children.diff, 2.1 KB (added by , 13 years ago) |
---|
-
wp-includes/comment-template.php
1320 1320 $add_below = 'div-comment'; 1321 1321 } 1322 1322 ?> 1323 <<?php echo $tag ?> <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">1323 <<?php echo $tag ?> <?php comment_class( $this->has_children ? '' : 'parent' ) ?> id="comment-<?php comment_ID() ?>"> 1324 1324 <?php if ( 'div' != $args['style'] ) : ?> 1325 1325 <div id="div-comment-<?php comment_ID() ?>" class="comment-body"> 1326 1326 <?php endif; ?> -
wp-includes/classes.php
768 768 var $max_pages = 1; 769 769 770 770 /** 771 * Wether the current element has children or not. To be used in start_el() 772 * 773 * @since 3.1.0 774 * @var bool 775 * @access protected 776 */ 777 var $has_children; 778 779 /** 771 780 * Starts the list before the elements are added. 772 781 * 773 782 * Additional parameters are used in child classes. The args parameter holds … … 849 858 850 859 $id_field = $this->db_fields['id']; 851 860 861 $id = $element->$id_field; 862 852 863 //display this element 864 $this->has_children = !empty( $children_elements[ $id ] ); 853 865 if ( is_array( $args[0] ) ) 854 $args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] ); 866 $args[0]['has_children'] = $this->has_children; // backwards compatibility 867 855 868 $cb_args = array_merge( array(&$output, $element, $depth), $args); 856 869 call_user_func_array(array(&$this, 'start_el'), $cb_args); 857 870 858 $id = $element->$id_field;859 860 871 // descend only when the depth is right and there are childrens for this element 861 if ( ( $max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id])) {872 if ( ( $max_depth == 0 || $max_depth > $depth+1 ) && $this->has_children ) { 862 873 863 foreach ( $children_elements[ $id ] as $child ){874 foreach ( $children_elements[ $id ] as $child ) { 864 875 865 876 if ( !isset($newlevel) ) { 866 877 $newlevel = true;