Notifications
Clear all

Message to inform user that the comment is closed

5 Posts
3 Users
0 Likes
2,187 Views
(@pyue6299)
Member Customer
Joined: 6 years ago
Posts: 53
Topic starter  

Hi team

I would like to see how can i show a message to my user informing them that when the comment is closed. 

Currently, i set my comment to be closed within 2 days after the post has been published, i want to display a message to my user after the comment has been closed. Please help thanks!

Regards

Patrick


   
Quote
Arina
(@arina)
Support Team
Joined: 10 years ago
Posts: 101
 

Hi @pyue6299,

There is no any option for this purpose. Please use the following code, put it in your current active theme functions.php file. 

add_action('comment_form_closed' , 'my_blog_commenting_colsed');
function my_blog_commenting_colsed(){
?>
<div> Enter your message here! </div>
<?php
}

   
ReplyQuote
(@pyue6299)
Member Customer
Joined: 6 years ago
Posts: 53
Topic starter  

thanks, that's work!


   
ReplyQuote
(@pyue6299)
Member Customer
Joined: 6 years ago
Posts: 53
Topic starter  

Hi I just discovered that, although the script is working as it should, but only to the extend that the post has comment. If there is no comment on it, the script will not run? i want it to run regardless the post has comment or not, any clue?


   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 6 years ago
Posts: 5872
 

Hi pyue6299,

This is native Wordpress working logic. If you disable wpDiscuz it'll work the same way. I'm really sorry, but wpDiscuz cannot change this logic. 


   
ReplyQuote
Share:
Scroll to top