small problem in the article ()

There’s two issues at play here.

First, you’ve got two sets of parentheses:

           ↓ Here                 ↓ And Here
echo '<div>(' . comments_number( '(0) ', '(1)', '(%)' ) . ')</div>';

You only want one.

Second, you’re trying to concatenate a string (.) with a function, comments_number(), that echoes. This results in comments_number() being outut immediately, and then the rest of the string outputting after that. This is where the second () comes from.

To fix the issue, either remove echo and output like this:

comments_number( '<div>(0)</div>div>', '<div>(1)</div>div>', '<div>(%)</div>div>' ) . ');

Or use get_comments_number_text() which returns the same value:

echo '<div>(' . get_comments_number_text( '0', '1', '%' ) . ')</div>';

Note that I’ve also removed the redundant parentheses.