finkyfeke
Member
Posted 1 year ago #
Hi,
I have a little notification of how many comments there are on each post.
<small class="comments">
<?php comments_number('No comments','1 comment','% comments'); ?>
</small>
The problem is that I don't want this to show if comments are disabled for a post.
Is there a function in wp that allows you to determine whether comments are enabled or not?
Thanks,
Richard
finkyfeke
Member
Posted 1 year ago #
Hi, look at settings, general, under membership.
mike.
finkyfeke
Member
Posted 1 year ago #
I want to be able to get whether comments are disabled or not as a true/false variable to use in php. So I can do something like this:
<?php if(comments_enabled()) { ?>
<small class="comments">
<?php comments_number('No comments','1 comment','% comments'); ?>
</small>
<?php } ?>
...where 'comments_enabled()' returns a boolean value based on whether this particular post has comments enabled.
But 'comments_enabled' isn't a function. I need something to replace it with that will return the value I'm looking for.
Thanks.