Ticket #7635: 7635.5.diff
| File 7635.5.diff, 2.4 KB (added by DD32, 5 years ago) |
|---|
-
wp-includes/comment-template.php
878 883 var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID'); 879 884 880 885 function start_lvl(&$output, $depth, $args) { 881 if ( 'div' == $args['style'] ) 882 return; 883 884 echo "<ul class='children'>\n"; 886 switch ( $args['style'] ) { 887 case 'div': 888 break; 889 case 'ol': 890 echo "<ol class='children'>\n"; 891 break; 892 default: 893 case 'ul': 894 echo "<ul class='children'>\n"; 895 break; 896 } 885 897 } 886 898 887 899 function end_lvl(&$output, $depth, $args) { 888 if ( 'div' == $args['style'] ) 889 return; 890 891 echo "</ul>\n"; 900 switch ( $args['style'] ) { 901 case 'div': 902 break; 903 case 'ol': 904 echo "</ol>\n"; 905 break; 906 default: 907 case 'ul': 908 echo "</ul>\n"; 909 break; 910 } 892 911 } 893 912 894 913 function start_el(&$output, $comment, $depth, $args) { … … 907 926 else 908 927 $tag = 'li'; 909 928 ?> 910 <<?php echo $tag ?> "<?php comment_class() ?>"id="comment-<?php comment_ID() ?>">929 <<?php echo $tag ?> <?php comment_class() ?> id="comment-<?php comment_ID() ?>"> 911 930 <?php if ( 'list' == $args['style'] ) : ?> 912 931 <div id="div-comment-<?php comment_ID() ?>"> 913 932 <?php endif; ?> … … 925 944 <?php echo apply_filters('comment_text', get_comment_text()) ?> 926 945 927 946 <div class='reply'> 928 <?php if ( $depth < $args['depth'] ) echo comment_reply_link(array('add_below' => 'div-comment')) ?>947 <?php if ( 0 == $args['depth'] || $depth < $args['depth'] ) echo comment_reply_link(array('add_below' => 'div-comment')) ?> 929 948 <?php if ( 'list' == $args['style'] ) : ?> 930 949 </div> 931 950 <?php endif; ?> … … 934 953 } 935 954 936 955 function end_el(&$output, $comment, $depth, $args) { 956 if ( !empty($args['end-callback']) ) { 957 call_user_func($args['end-callback'], $comment, $args, $depth); 958 return; 959 } 937 960 if ( 'div' == $args['style'] ) 938 961 echo "</div>\n"; 939 962 else … … 954 977 * @param $args string|array Additional arguments 955 978 */ 956 979 function wp_list_comments(&$comments, $args = array() ) { 957 $defaults = array('walker' => null, 'depth' => 3, 'style' => ' list', 'callback' => null);980 $defaults = array('walker' => null, 'depth' => 3, 'style' => 'ul', 'callback' => null, 'end-callback' => null); 958 981 959 982 $r = wp_parse_args( $args, $defaults ); 960 983
