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


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() {
| 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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