Changeset 54335 for trunk/src/wp-includes/blocks/comment-template.php
- Timestamp:
- 09/27/2022 05:30:41 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/blocks/comment-template.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/comment-template.php
r53338 r54335 17 17 function block_core_comment_template_render_comments( $comments, $block ) { 18 18 global $comment_depth; 19 $thread_comments = get_option( 'thread_comments' ); 20 $thread_comments_depth = get_option( 'thread_comments_depth' ); 19 21 20 22 if ( empty( $comment_depth ) ) { … … 47 49 // If the comment has children, recurse to create the HTML for the nested 48 50 // comments. 49 if ( ! empty( $children ) ) { 50 $comment_depth += 1; 51 $inner_content = block_core_comment_template_render_comments( 52 $children, 53 $block 54 ); 55 $block_content .= sprintf( '<ol>%1$s</ol>', $inner_content ); 56 $comment_depth -= 1; 51 if ( ! empty( $children ) && ! empty( $thread_comments ) ) { 52 if ( $comment_depth < $thread_comments_depth ) { 53 $comment_depth += 1; 54 $inner_content = block_core_comment_template_render_comments( 55 $children, 56 $block 57 ); 58 $block_content .= sprintf( '<ol>%1$s</ol>', $inner_content ); 59 $comment_depth -= 1; 60 } else { 61 $inner_content = block_core_comment_template_render_comments( 62 $children, 63 $block 64 ); 65 $block_content .= sprintf( $inner_content ); 66 } 57 67 } 58 68
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)