The first image shows that the Hottest Comment Threads Filter Button appears even when there is no comments!
The second image shows the Comments Sorting Buttons as well as the Hottest Comment Threads Filter Button as it has to be, as there are 16 comments.
Is it possible to use a snippet code to correct the problem or is it necessary to update the wpDiscuz plugin?
If so, what would be the code?
Thanks in advance!
Hi,
We'll check and get back to you soon.
Hello,
Any news about this?
Thanks in advance!
I can't activate the PHP code. See the error:
We encountered an error activating your snippet, please check the syntax and try again. Error message: syntax error, unexpected identifier commentsCount
It worked, but Lighthouse accused errors!
What can be done to avoid these errors?
PS. I used your code to create another to hide the comments sorting buttons too...
jQuery(document).ready(function() { const commentsCount = parseInt(jQuery('.wpd-thread-info').attr('data-comments-count'), 10); if (isNaN(commentsCount) || (typeof commentsCount === 'undefined') || commentsCount < 2) { jQuery('.wpdf-sorting').hide(); } });
Thanks in advance!
I disabled the additional snippet I mentioned and limited your snippet exclusively for posts (location: site wide header).
Errors no longer appear in Lighthouse and I hope I have done nothing that harms my site or the wpDiscuz plugin. 🤔
But I would still like to hide the comments sorting buttons too!
Please, could you change your code so that the comments sorting buttons are also hidden when there is only 1 comment?
In my opinion it makes no sense to show filters when there is 1 comment. Filters cannot do anything with only 1 comment. 🙂
Thanks in advance!