Support » Fixing WordPress » Hiding "Comments are Closed" ?

  • For posts where I have comments disabled, I would like the text, “Comments are Closed” to not even appear at all.

    Is it adequate for me to amend the class associated with that? I think the class is “nocomments”

    or, is there a more sound way of doing it?

    Thank you!


Viewing 3 replies - 1 through 3 (of 3 total)
  • if the class is nocomments then in your style.css you add:

    html body .nocomments { display: none !important }

    you will have to re-add that every time the theme is updated, so you may want to look into child-themes to preserve you code, or writing a 4-line plugin so it’s always on your site.

    The theme in question is my own, so..that line will live in my style.css

    but how would I write the 4-line plugin? That sounds like a thing good to know how to do!

    thank you!


    a simple plugin

    make dir


    make file


    === PluginName ===
    Plugin Name: PluginName
    Plugin URI: http://
    Author URI: http://
    Donate link:
    Requires at least: 4
    Tested up to: 4
    Stable tag: 0.1
    Version: 0.1
    == Description ==
    == Installation ==
    == Upgrade Notice ==
    == Screenshots ==
    == Changelog ==
    = 0.1 =
    == Frequently Asked Questions ==

    and another file


    Plugin Name: PluginName
    Plugin URI: http://
    Author URI:
    Version: 0.1
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <>.
    add_action('wp_head',create_function('$a', "return '<style>html .nocomments{display:none!important}</style>';"));

    i forget if you actually need the readme when it’s your own dev plugin, but incase you ever want to publish it, that’s the template, I always bother doing anyways.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hiding "Comments are Closed" ?’ is closed to new replies.