After upgrading to the Learndash v3 i was facing a big issue with the comments not being visible on any of the topics.
Even after adding a custom comments template in the theme it would still show the topic has no comments and after debugging for a while i disabled the focus mode and i was able to see all the comments.
But now i wanted the visual elements of the focus mode.
So i have resolved this for you. What Learndash is doing is its removing the topic comments at the ‘wp’ hook level with the function learndash_remove_comments.
In my case i did not want Learndash controlling the comments at all so this function worked exactly as i wanted it to.
You can copy the code below and paste it in your functions.php file of the theme.
add_action( 'wp', 'control_comments' ); function control_comments(){ remove_filter( 'comments_array', 'learndash_remove_comments', 1, 2 ); remove_filter('comments_open', 'learndash_comments_open', 10, 2); }
If the above code shows comments on Course or lesson pages then just disable the comments on them from the admin panel. (In my case they were already disabled for course and lesson post types)
12 Responses
Where do I need to paste this code?
I pasted it in appearance > theme editor > Theme functions (functions.php) but it doesnt work
where in the functions.php file should i paste it ?
After <?php
You can post it at the end of functions.php file. Any code in functions.php should be after
I tried it but it doesnt work 🙁
https://www.examoid.com/wp-content/uploads/2019/10/comments.png
The above is a screenshot of what I’m doing
Fayzan, the code might be conflicting with another function active on the same action. You’ll have to debug that part. Same code is working for me on a clean install.
Thank you very much for this gold mine!
Helped me to have the comments & still have the Focus mode turned on!
Thanks a lot!
Thanks! I got the comments back thanks to this suggestion. However, the avatars are now duplicated on those pages and design elements are a somewhat mess. No nesting and reply button on comments doesn’t work. Any ideas where to start looking into this issue?
I am glad the code helped you! Regarding the other issues, it seems like the site has some customization that might be doing all of that. Look for any plugins that were used for the styling of comments or any custom code in place (start with functions.php file).
Thank you for such an easy solution. I have one question. I have thrive comments as a comment platfrom. But on the Focus Mode it is shown as common WordPress comments. How can I enable Thrive comments (or any other comments platfrom) on LearnDahs Focus Mode.
On the course page there is Thrive comments, so they work ) But not in Focus Mode
Rina, check if Thrive comments has some specific settings about post types and if it needs to be enabled for lessons/topics? If not then probably a custom function needs to be created to replace WordPress comments with Thrive comments.
Thank you so much for this. One issue is that I do not see the ability for a user to nest replies, even though that is turned on in Settings->Discussion.
This led me to using WPDiscuz as a commenting system. Very feature rich. But if I use your code snippet and the solution posted here, both WPDiscuz and WordPress comments appear.
https://gvectors.com/forum/how-to-and-troubleshooting/wpdiscuz-for-learndash-comments/
Any solution?
BBTNG,
The above function is just removing the LearnDash functions which manipulate the comments functionality. So once the LearnDash functions are removed the next function in priority either in your theme or plugins is doing that. Try looking into functions.php or comments template file in your theme.
Jeez man, thank you for the code! You just saved me a bunch of hours looking to solve this.
Cheers,
Billy