How to hide the WordPress comment form?

I have a plugin that allows Facebook to comment on WordPress. Users requested a feature that will hide the default WordPress comment form on posts where Facebook commenting is enabled.

How can I hide the WP comment form? I know I can comment on comment_form(); from the comments.php template, but I would like to be able to hide / show it when I click on the button.

Is this related to the comments_template filter?

Plugin homepage http://grahamswan.com/facebook-comments

+2
comments filter wordpress
source share
1 answer

Wrap the form in a div and use this simple jquery piece to show / hide the div.

 <div class="comments"> <?php comment_form(); ?> </div> <a class="comment_switch">Show / Hide Comments</a> .hidden{display:none;} $("comment_switch").click(function () { $("comments").toggleClass("hidden")"); }); 
+5
source share

All Articles