@@ -736,33 +736,33 @@ |
||
736 | 736 | $overridden_cpage = true; |
737 | 737 | } |
738 | 738 | |
739 | - foreach($comments as $key => &$comment) { |
|
740 | - $timber_comment = new $CommentClass($comment); |
|
741 | - $timber_comment->reply_link = $this->TimberComment_reply_link($comment->comment_ID, $this->ID); |
|
742 | - $timber_comments[$timber_comment->id] = $timber_comment; |
|
743 | - } |
|
739 | + foreach($comments as $key => &$comment) { |
|
740 | + $timber_comment = new $CommentClass($comment); |
|
741 | + $timber_comment->reply_link = $this->TimberComment_reply_link($comment->comment_ID, $this->ID); |
|
742 | + $timber_comments[$timber_comment->id] = $timber_comment; |
|
743 | + } |
|
744 | 744 | |
745 | 745 | // Build a flattened (depth=1) comment tree |
746 | 746 | $comments_tree = array(); |
747 | - foreach( $timber_comments as $key => $comment ) { |
|
748 | - if ( ! $comment->is_child() ) { |
|
749 | - continue; |
|
750 | - } |
|
751 | - |
|
752 | - $tree_element = $comment; |
|
753 | - do { |
|
754 | - $tree_element = $timber_comments[$tree_element->comment_parent]; |
|
755 | - } while($tree_element->is_child()); |
|
756 | - $comments_tree[$tree_element->id][] = $comment->id; |
|
757 | - } |
|
758 | - |
|
759 | - // Add child comments to the relative "super parents" |
|
760 | - foreach($comments_tree as $comment_parent => $comment_children) { |
|
761 | - foreach($comment_children as $comment_child) { |
|
762 | - $timber_comments[$comment_parent]->children[] = $timber_comments[$comment_child]; |
|
763 | - unset($timber_comments[$comment_child]); |
|
764 | - } |
|
765 | - } |
|
747 | + foreach( $timber_comments as $key => $comment ) { |
|
748 | + if ( ! $comment->is_child() ) { |
|
749 | + continue; |
|
750 | + } |
|
751 | + |
|
752 | + $tree_element = $comment; |
|
753 | + do { |
|
754 | + $tree_element = $timber_comments[$tree_element->comment_parent]; |
|
755 | + } while($tree_element->is_child()); |
|
756 | + $comments_tree[$tree_element->id][] = $comment->id; |
|
757 | + } |
|
758 | + |
|
759 | + // Add child comments to the relative "super parents" |
|
760 | + foreach($comments_tree as $comment_parent => $comment_children) { |
|
761 | + foreach($comment_children as $comment_child) { |
|
762 | + $timber_comments[$comment_parent]->children[] = $timber_comments[$comment_child]; |
|
763 | + unset($timber_comments[$comment_child]); |
|
764 | + } |
|
765 | + } |
|
766 | 766 | |
767 | 767 | $timber_comments = array_values($timber_comments); |
768 | 768 |