0

I have comments turned on across the site, but I also have the "Automatically close comments on articles older than 90 days" option turned on.

How can I have it show some kind of "Comments Are Closed" message at the bottom of the comments on posts where comments have automatically turned off after 90 days?

And then, as an added bonus, how do I not have that message show on posts where I've manually turned off comments myself because I simply didn't allow comments on those posts?

Thanks in advance for any help.

  • Is your theme using comments.php? If so, something like <?php if ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) { ?> <p class="comments-closed"><?php _e( 'Comments are closed.', 'textdomain' ); ?></p> <?php } ?> should do the trick. – Dave Romsey Apr 21 '17 at 19:37
  • Hello again! Nope, no comments.php in my theme. Just a functions.php. – ioutshine Apr 21 '17 at 20:10
  • Hello! I'd suggest adding a comments.php (create a child theme and add it there, don't modify your original theme unless you've created it yourself). Take a look at Twenty Sixteen's comments.php for inspiration. – Dave Romsey Apr 21 '17 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.