WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

when we open a post, we at the bottom of the page field to post a comment
I would like to hide this field.
if there are comments, usually shows them
however to leave a comment, click a button
with this, the field appears to leave a comment

Anyone have a clue how to do this?
Through either normal or ajax

share|improve this question
up vote 0 down vote accepted

you can do this very easily with jQuery

simply wrap your comment form in a div and hide, add a button or a link and on his click event show the comment form so smoothing like this:

<a href="#" ID="Leave_a_comment">Leave a Comment</a>
<div id="comment_form_wrapper" style="display: none;">
    <?php comments_template( '', true ); ?>

<script type="text/javascript">
    $(document).ready(function() {
        $('#Leave_a_comment').click(function() {
share|improve this answer
i will test and say something about it, thanks so much – Alyson Veras Jul 21 '11 at 23:37
don't work for me. when I click nothing happens.I replaced the <php comments_template ();> their code in my single.php – Alyson Veras Jul 22 '11 at 0:25
i found the solution using this link forum.wmonline.com.br/topic/… thanks a lot – Alyson Veras Jul 22 '11 at 1:24
Its an example since i don't really know what your theme is, and i guess you need to include jQuery for it to work – Bainternet Jul 22 '11 at 9:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.