Support » Fixing WordPress » CSS for only removing "Comments Off" ?

  • Resolved IslandOwl


    Is there a way with CSS to make it so the Comments show if you have comments but do not show “COMMENTS OFF”. When I have posts or pages with comments turned off I don’t need that statement there. I would like it to show nothing.

    Way down near the bottom of this discussion @thejiggerypokery supplied the php code to do what I want it to do but if I can change it in CSS that would be preferred.

    I would like to set it so it displays as follows:

    if no comments, displays –> Leave a comment »
    if 1 comment, displays –> 1 comment »
    if more than one comment (e.g. 5), displays –> 5 comments »
    css class –> not defined
    if comments are off, displays –> is blank

    The php code to make it do that is:
    <?php comments_popup_link('Leave a comment »', '1 Comment »', '% Comments »', '', ''); ?>

    Ps. I am using the Brunelleschi Theme too. GREAT theme!

Viewing 15 replies - 1 through 15 (of 15 total)
  • This content is generated by WP through the PHP code in use and output as HTML on the page…the manner to change the output properly is to modify the php, preferably in a child theme.

    it depends on your theme.. can you share a link to your site? or a demo version of the theme which have posts with “comments turned off”

    Or, even better, is there a way to make “COMMENTS OFF” not show up on a post by post basis? – because it is really only my sticky post that I want to remove it from.



    Forum Moderator

    there is no distinctive css selector if the comments are off; best solution is to edit the php code as suggested.

    formatting belongs into style.css – not into the content or template files. at the moment it is showing in your site.

    however, if you know the post ID, you can use css to hide the comments link for individual posts;
    example to be added into style.css:

    .post-155 .entry-utility { display:none; }

    Yes, this can be done per post:

    Admin Dashboard>Posts>All Posts>Hover over the post>Click ‘Quick Edit’>Uncheck ‘Allow comments’>Save>Clear server cache if in use.



    Forum Moderator

    it is really only my sticky post that I want to remove it from

    that makes it easy, as your theme uses post_class() which adds a css class of .sticky to the post div;

    in style.css, add:

    .sticky .entry-utility { display: none; }

    Thank you alchymyth. That is a great idea to just put the css in for that one post.

    If I do want to change the php, what file would I find it in? I have looked and cannot even see where “COMMENTS OFF” is being generated, nor “Leave a Comment”. It is not in the comments.php nor the functions.php.

    I am not sure what you mean by “formatting belongs into style.css – not into the content or template files. at the moment it is showing in your site.” unless it was that I had just out of curiosity tried to see if I could use css on that first post – but it showed up in the post. You may have caught it right then for the minute it was there.

    Thank you Swanson Photos but on many themes (Brunelleschi Theme which I am using) when you uncheck ‘Allow Comments’ instead of that just leaving a blank space the theme puts in “COMMENTS OFF” and it is that very thing that I am trying to get rid of.

    Awesome alchymyth!! That worked!

    (We were writing at the same time so ignore the post above this one. But I am still curious where that php code is located.)

    One more question though. What could I put in that would remove the date on just the sticky post – remove that whole line of “Posted On”?



    Forum Moderator

    in the same way:

    .sticky .entry-meta { display: none; }

    THANK YOU!! And now, since it is 2:45am, I am going to call it a night!

    Then would title be:
    .sticky .entry-title {display:none;}

    I am sorry, I don’t know where to find what the different areas are called. I tried looking in the codex but must not be asking the question clearly enough.

    Answered me own question! I tried it and it worked!

    Thank you again for all your help tonight!

    This is resolved. Forgot to check that two weeks ago.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘CSS for only removing "Comments Off" ?’ is closed to new replies.