
On posts where comments are closed, the plugin will remove the text ‘Comments are closed.’ The plugin supports any languages/text domains, and will remove the text from themes and plugins.
Prerequisite: Since the plugin is filtering gettext, your theme/plugin must be localized.
The plugin is available in the WordPress plugin directory
Plugin source code:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<?php /* Plugin Name: Remove "Comments are closed" Plugin URI: http://soderlind.no/archives/2012/01/11/wordpress-plugin-remove-comments-are-closed/ Description: On posts where comments are closed, the plugin will remove the text 'Comments are closed.' The plugin supports any languages/text domains, and will remove the text from themes and plugins. Author: Per Soderlind Version: 1.2 Author URI: http://soderlind.no/ */ add_filter('gettext', 'ps_remove_comments_are_closed', 20, 3); function ps_remove_comments_are_closed($translated_text, $untranslated_text, $domain) { if ( $untranslated_text == 'Comments are closed.' ) { return ''; } return $translated_text; } ?> |
Changelog:
- 1.2 removed unnecessary code
- 1.1 initial public release
I intstalled this Plugin. The “Comments Are Closed” tag still remains on my blog. Can you please help here.
Hi,
Where? I had a look at your blog but couldn’t find it.
If your blog theme isn’t localized, my plugin will not work.
Please click on this link below. Go to the bottom of the post & you will see the “Comments are Closed”.
http://www.meghashyam.com/2012/01/19/chocolates-grown-ups/
My plugin, using gettext, search for the exact string ‘Comments are closed.’ (including the period), this is the standard text used by WordPress. I suggest that you remove the period from the string in my plugin (line 15 above).
If I want my WP theme to be only English do i need to localize to? I am a very beginner and the article you are referring for localization is too difficult to implement. I just want to remove comments are closed without touching any code. why can;t i do it? thank you.
Hi Alex,
No you don’t have to localize it yourself, but you must choose a theme that has localization code. If the text in the theme is wrapped in __() or _e() functions, you are fine.
If you give me the url to where you found the theme, I can check this for you.
Btw, the default themes, Twenty Ten an Twenty Eleven, has localization code.
I installed, it, on newest version of WP, it appears it set my site to use a static home page, then I tried to de activate it, and it seems on de activation, it does not revert everything it did?
It doesn’t do anything to wordpress db etc, so turning it off will remove it.
What’s the theme you’re running ? Are you running any caching plugins ? Any other new plugins added lately?
Hi. I tried it with the mainstream (woo themes) theme and it did not work.
No no other plugins, no caching plugins. Yours is the only one activated.
So I take it, when you de activate it, it does not revert the changes it made? Tks
Most of the themes have their “internal plugins” aka THEMEFOLDER/functions.php, so for me to be able to see if there’s a conflict, I need to know which woo theme you’re using.
The plugin (see code above) only filters gettext, the only reason that it doesn’t revert when you switch the plugin off is that your wordpress / theme is caching the output.
Doesn’t work with the Flexibility theme, is it because they use different text – “Comment Off”
You can change the text using the plugin editor (/wp-admin/plugin-editor.php?file=remove-comments-are-closed/ps_remove_comments_are_closed.php)
..or, instead of using my plugin, you can add the following to the (child ) theme functions.php:
The Plugin Spam Free WordPress has a comments.php file in it’s folder. Removing that file solved the problem on my blog
Thanks for the plugin by it does not working for me. Using template monster’s template
“not working for me” .. what’s not working ? If the text in monster’s template is different than the default; instead of using the plugin, add the routine to your (child) theme functions.php as described above
Thank you for the reply but I’m not a programmer and I thought this plugin will do the work without getting into the code. “Not working” as this plugin does not remove the comments text. Can you assist?
Hi,
I installed the pluign but the text “comments closed” still shows up.
My theme is Bombax and I have no idea if it is localized or not.
Here you are my website:
http://www.freereporter.info
I would be grateful if you could help
Cheers
Stefano
Stefano, please read the comments above.
I have explain how to check if your theme uses gettext.
The plugin replaces this ‘Comments are closed.’ with blank, if the theme author chose to write something else, instead of using my plugin, add code to your THEMEFOLDER/functions.php with the text string you want to remove.
Crap.
Destroyed everything. Had to install everything new.
There is no reason why this simple plugin will destroy anything. Read the code and you’ll see that I’m right.