Support » Fixing WordPress » How to put “Comments are now closed”?

  • I’m looking at my comments template and it has the following logic:

    if there are comments
    ::show the comments
    else if there are none
    ::if comments are open
    ::::show the comment form
    ::else if comments are closed
    ::::show <p>Comments are closed</p>
    ::end if
    end if

    What I want and what I don’t get is where to put my message if there ARE comments and comments are CLOSED. I think there may be lacking another if somewhere to check for that? Thanks for any help and here’s the actual code in case it helps.

    <?php if ($comments) : ?>
    <h3 id="comments"><?php comments_number('No Comments', 'One Comment:', '% Comments:' );?> <a href="#respond" title="Leave your own comment">»</a></h3>
    <ol class="commentlist">
    <?php foreach ($comments as $comment) : ?>
    <li class="<?php echo $oddcomment; ?><?php if (function_exists('author_highlight')) author_highlight(); ?>" id="comment-<?php comment_ID() ?>">
    <big><?php comment_author_link() ?></big> <small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title="Permalink for this comment"><?php comment_date('M. j, ‘y') ?> at <?php comment_time() ?></a> <?php jal_edit_comment_link('Edit?','| ','',''); ?></small>
    <?php comment_text() ?>
    <?php if ($comment->comment_approved == '0') : ?><em>Your comment is awaiting moderation.</em>
    <?php endif; ?>
    <?php /* Changes every other comment to a different class */
    if ('odd' == $oddcomment) $oddcomment = '';
    else $oddcomment = 'odd';
    <?php endforeach; /* end for each comment */ ?>
    <?php else : // this is displayed if there are no comments so far ?>
    <?php if ('open' == $post->comment_status) : ?>
    <!-- If comments are open, but there are no comments. -->
    <?php else : // comments are closed ?>
    <!-- If comments are closed. -->
    <p class="nocomments">Comments for this entry are now closed to prevent spam and irrelevent replies. If you have a genuine comment to make you can <a title="View contact details" href="/about/author/contact">contact</a> the author.
    <?php endif; ?>
    <?php endif; ?>

  • The topic ‘How to put “Comments are now closed”?’ is closed to new replies.