I need to hide the comments to non members in wordpress.
I don’t know the function to I have to implement in the template. Maybe you can help me with this?
To be clear, the only thing I want to do is that only members can view comments posted.
Thanks.
If you are a litlle bit familiar with PHP you can have these blocks of code to block the comments displays for non logged users. Open the comments.php file or whatever file assumes that role.
You can add this line of code at the top of that PHP file:
Then add the line below at the very end of the file.
I just spent two hours trying to do this, only to find an incredibly simple option that didn’t need php. I’m using Live Composer, and my theme doesn’t have a comments.php (and trying to create one didn’t work – the site just ignored it). Here’s what I did:
1) add a custom class to my comments element of .commentlist
2) add this to my style.css: