The effects of alcohol on
sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Question [Solved] Hottest Comment Threads Filter Button
✦
✦
✦
AI is analyzing the discussion...
Topic starter
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
Jul 05, 2024 6:15 am
(@doctorbr)
Trusted Member
Joined: 2 years ago
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!
Support
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
Jul 05, 2024 11:34 am
(@asti)
Illustrious Member
Joined: 8 years ago
Hi,
We'll check and get back to you soon.
Topic starter
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
Jul 10, 2024 5:04 am
(@doctorbr)
Trusted Member
Joined: 2 years ago
Hello,
Any news about this?
Thanks in advance!
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8208
Jul 10, 2024 1:19 pm
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
@doctorbr
You can use the code below to control the display of the filters and sorting buttons:
const commentsCount = parseInt(jQuery('.wpd-thread-info').attr('data-comments-count'), 10);
if (isNaN(commentsCount) || (typeof commentsCount === 'undefined') || commentsCount < 1) {
jQuery('.wpdf-hottest').hide();
}
Topic starter
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
Jul 11, 2024 1:38 am
(@doctorbr)
Trusted Member
Joined: 2 years ago
@Asti
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
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8208
Jul 11, 2024 2:10 pm
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
@doctorbr
This is a javascript code, not the PHP.
Topic starter
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
Jul 11, 2024 11:20 pm
(@doctorbr)
Trusted Member
Joined: 2 years ago
@Asti
Still does not work.
What can be wrong?
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8208
Jul 12, 2024 2:42 pm
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
@doctorbr
Try this one:
jQuery(document).ready(function() {
const commentsCount = parseInt(jQuery('.wpd-thread-info').attr('data-comments-count'), 10);
if (isNaN(commentsCount) || (typeof commentsCount === 'undefined') || commentsCount < 1) {
jQuery('.wpdf-hottest').hide();
}
});
Topic starter
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
Jul 13, 2024 5:01 am
(@doctorbr)
Trusted Member
Joined: 2 years ago
@Asti
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!
Topic starter
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Show original
Translating...
Jul 13, 2024 6:32 am
(@doctorbr)
Trusted Member
Joined: 2 years ago
@Asti
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!