WordPress.org

Ready to get started?Download WordPress

Forums

show and hide individual comments (4 posts)

  1. jjshih
    Member
    Posted 5 years ago #

    Hello,

    I was wondering if anyone knows how I can show and hide individual comments instead of hiding the entire comment block. For example, if I have multiple comments on one post all the comments would be hidden by default displaying only the titles and dates but no content. There would be a toggle link that when clicked on would hide and show the content of that individual comment.

    I have tried to use some of the ajax plugins available but they only show and hide all comments. I have also tried my amateurish hand at JavaScript but I was only able to get the first comment to hide and show. Hope this is clear.

    Thank you in advance for your help.

    Jared

  2. jjshih
    Member
    Posted 5 years ago #

    Hello,

    I was just wondering if anyone could point me to right direction here. Thanks again.

    Jared

  3. jjshih
    Member
    Posted 5 years ago #

    Hi,

    Still wondering... Thank you. Happy Thanksgiving

  4. texet
    Member
    Posted 5 years ago #

    I've been wondering the same thing. It seems like this would be one approach:

    1. Create a new function that sets an individual comment status to 'hidden', or maybe sets comment_approved to the value 2 (I think normally it's 0 for not approved and 1 for approved).

    2. In comments.php, create a conditional statement that skips the display of 'hidden' comments: "if $row['comment_approved'] is 2, then don't display this comment."

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags