WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Corporate theme] trying to add a comments closed notification (2 posts)

  1. shilojean
    Member
    Posted 3 years ago #

    Hello,
    I am using Ori Pearl's fantastic theme Corporate for my blog and I'd like to add a "comments are closed" notification to posts with closed comments.

    I tried changing this:
    `<?php if ('open' == $post->comment_status) : ?>
    <p><?php _e('Nope, no comments yet.'); ?></p>`

    to this:
    `<?php if ('open' == $post->comment_status) : ?>
    <p class="center">Nope, no comments yet.</p>
    <?php else : // Comments are closed ?>
    <p><?php _e('Comments are closed on this post.'); ?></p>`
    directly after the <div class="allcomments" tag, and while I thought it worked, it turns out, I was merely sleep deprived and it totally didn't, and in fact made it so that archived posts comments weren't even displayed. I tried it in a number of other places I thought it may work but it was syntax errors all around.

    I've searched through the codex for HOURS and come up empty handed.
    If anyone has any ideas about how to get a comments closed notification up in addition to keeping the comments viewable, you will be my hero.

    Thanks.

  2. shilojean
    Member
    Posted 3 years ago #

    Figured it out!

    In case anyone else is trying to do the same, all you have to do is change the very last bit of code in the comments.php file from this:

    <?php endif; ?>
    	<?php endif; ?>
    </div>

    to this:

    <?php endif; ?><?php else : ?> Comments are closed on this post
    	<?php endif; ?>
    </div>

    Viola!

Topic Closed

This topic has been closed to new replies.

About this Topic