Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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 ); ?>
</div>

<script type="text/javascript">
    $(document).ready(function() {
        $('#Leave_a_comment').click(function() {
            $('#comment_form_wrapper').show();
        });
    });
</script>
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
add comment

Your Answer

 
discard

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.