get_the_ID(), 'status' => 'approve', 'parent' => $comment_id, 'order' => 'ASC' )); if ($replies) { $count += count($replies); foreach ($replies as $reply) { $count += count_nested_replies($reply->comment_ID); } } return $count; } if (post_password_required()) { return; } if (!is_user_logged_in()) { ?>

,

get_the_ID(), 'status' => 'approve', 'parent' => 0, 'order' => 'ASC' )); if ($top_level_comments) { echo '
'; foreach ($top_level_comments as $comment) { ?>

pll__('Ответить'), 'depth' => 1, 'max_depth' => get_option('thread_comments_depth'), 'before' => '', 'after' => '', ), $comment->comment_ID, get_the_ID()); ?>
comment_ID); if (!empty($all_nested_replies)) { $total_reply_count = count($all_nested_replies); ?>

pll__('Ответить'), 'depth' => 2, 'max_depth' => get_option('thread_comments_depth'), 'before' => '', 'after' => '', ), $reply->comment_ID, get_the_ID()); ?>
'; } function get_all_nested_replies($comment_id) { $all_replies = array(); $direct_replies = get_comments(array( 'post_id' => get_the_ID(), 'status' => 'approve', 'parent' => $comment_id, 'order' => 'ASC' )); $all_replies = array_merge($all_replies, $direct_replies); foreach ($direct_replies as $reply) { $deeper_replies = get_all_nested_replies_recursive($reply->comment_ID); $all_replies = array_merge($all_replies, $deeper_replies); } return $all_replies; } function get_all_nested_replies_recursive($comment_id) { $replies = get_comments(array( 'post_id' => get_the_ID(), 'status' => 'approve', 'parent' => $comment_id, 'order' => 'ASC' )); $all_replies = $replies; foreach ($replies as $reply) { $deeper_replies = get_all_nested_replies_recursive($reply->comment_ID); $all_replies = array_merge($all_replies, $deeper_replies); } return $all_replies; } if (is_user_logged_in()) { $commenter = wp_get_current_commenter(); $args = array( 'fields' => array( 'author' => '', 'email' => '', 'url' => '', 'cookies' => '', ), 'comment_field' => '
', 'title_reply' => pll__('Оставить комментарий'), 'title_reply_to' => pll__('Ответить %s'), 'class_submit' => 'comment-submit-btn', 'submit_button' => '', 'submit_field' => '
%1$s %2$s
', 'cancel_reply_link' => pll__('Отменить'), 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply_before' => '

', 'title_reply_after' => '

', ); comment_form($args); } ?>