I’m sorry that this might be annoying, as I am posting a lot of code
For larger blocks of code, use the WordPress pastebin and post the pastebin url here. It makes life easier for everyone.
Try changing:
<?php if (!isset($_GET['ajax'])) { ?>
<div class="form" id="respond">
to:
<?php if (!isset($_GET['ajax']) && 'open' == $post->comment_status ) { ?>
<div class="form" id="respond">
Thread Starter
gammel
(@gammel)
Sorry about that, the Pastebin resource looks really handy.
I tried your code and it removes the form on closed for comments entries.
That’s brilliant!
Is it now possible to echo “Comments are closed” where the form used to be?
But even the way it is is a huge improvement, thanks
Try changing:
</div>
<?php endif; ?>
<?php } ?>
</div> <!-- end comments -->
at the bottom of the code to:
<?php else echo '<p class="comments-closed">Comments are now closed</p>';?>
</div>
<?php endif; ?>
<?php } ?>
</div> <!-- end comments -->
(@gammel)
16 years, 5 months ago
Hi everyone. I’m sorry that this might be annoying, as I am posting a lot of code. Basically when comments are closed the comment form is still appearing. I want to change it so a message is displayed, something like “Comments are now closed for this entry”
I see that other people have asked this question before but I cannot seem to get it working, I don’t understand where to put the code within comments.php.
If someone could please tell me the code and where to place it in comments.php I would be very grateful. I thought the best way was just to ask here and provide the code, as someone with knowledge could answer very easily!
Comments.php: