Site icon Hip-Hop Website Design and Development

Counting Feedback as Singular and Plural in feedback.php Template

I need assistance on learn how to depend single and plural feedback in relation to how the textual content is formatted.

Present output:
Dialogue: 1 feedback and 1 solutions

Desired output:
Dialogue: 1 remark and 1 reply
or, when plural – as above.

I have been attempting this backwards and forwards and I’m caught.

That is my code from my feedback.php template:

<?php
$number_of_parents = comment_counter($post->ID);
$number_of_children = $post->comment_count - $number_of_parents;
?>
<?php if (have_comments()) : ?>
<h3 class="comments-title">Dialogue: 
<?php if ($number_of_children > 0){
echo ''.$number_of_parents.' questions and '.$number_of_children.' solutions.';
} else {
echo 'Questions: '.$number_of_parents.'';
} ?></h3>

The perform pertains to this perform, which I’ve in my features.php file:

perform comment_counter($id){
international $wpdb;
$question = "SELECT COUNT(comment_post_id) AS count FROM $wpdb->comments WHERE `comment_approved` = 1 AND `comment_post_ID` = $id AND `comment_parent` = 0";
$mother and father = $wpdb->get_row($question);
return $parents->depend;
}