Hiding "No Comments" and "Closed for comments."

Is there a way to hide "No Comments" and "Closed for comments."?

I was hoping that I could control it in the theme or that there might be a CSS class that I could set to display: none, but there doesn't appear to be.

I could edit the PHP file directly, but I would prefer not to edit core files directly.

From what I can see, I can have a local copy of the comment_form/comment_form.php file, but the same doesn't hold true for the main comment_form.php file.

Ideally, there would be a class such as "no-comments" applied to the "No Comments" h3 and a class of "comments-closed" applied to the "Closed for comments." h3 and the "Subscribe to comments" link, when applicable.

Is there a way I can do this myself? Is there a possibility of having this added in the future?

Comments

  • acrylian Administrator, Developer
    You can make a custom plugin of this. Or you just add a check if there are comments or closed and hide the form inclusion completely. See the documentation.
  • A class added to the h3 is a good idea. It will be in the 1.4.1 release. You can preview it in the development nightly builds (after tonight, so that the change is there) The h3 will have class="empty" added.
  • acrylian Administrator, Developer
    I would ten suggest to give it a speaking name indeed like "no-comments" or "comments-closed". Of course the wrapper div will still be there.
  • toxalot Member
    To be clear, there are two separate items: whether or not there are comments and whether or not comments are open. You can have no comments and have comments open. I assume you can also have comments and have comments closed.

    It would be nice to know both and have them nested. For example, if comments are closed and there are no comments, I could remove the whole block. But if there are comments and comments are closed, I'd like to let the user know that comments are closed.

    I'm not sure it's possible to achieve what I'd like with just adding a few classes to the current HTML. I may end up writing my own plugin.
  • acrylian Administrator, Developer
    You could easily hide the printCommentForm call with an `if` check if there are actually comments using `getCommentCount()`.
Sign In or Register to comment.