Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

User:MattRead/Template Files

Comment Structure

Password Protected

<?php if ( !empty($post->post_password) && $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>

This checks to see if the post was password protected, if it is, then it checks to see if the user has entered the post password and password is correct for this post. If these conditons are not met, display the following.

<?php _e('Enter your password to view comments.'); ?>

<?php return; endif; ?>


// check if the post has comments <?php if ( $comments ) : ?>

// loop through each comment <?php foreach ($comments as $comment) : ?>

// display each comment here formatted like the following: yada yada yada

// end the comment loop <?php endforeach; ?>

// If there are no comments yet <?php else : ?>

//display text

<?php _e('No comments yet.'); ?>

<?php endif; ?>

<?php if ( comments_open() ) : ?> form </nowiki>

<?php else : // Comments are closed ?>

<?php _e('Sorry, the comment form is closed at this time.'); ?>

<?php endif; ?>