📄 comments.php
字号:
<?php // Do not delete these lines
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?>
<p class="nocomments">This post is password protected. Enter the password to view comments.<p>
<?php
return;
}
}
/* This variable is for alternating comment background */
$oddcomment = 'alt';
?>
<!-- You can start editing here. -->
<? global $hemingway ?>
<?php if ($comments) : ?>
<ol id="comments">
<?php foreach ($comments as $comment) : ?>
<li id="comment-<?php comment_ID() ?>">
<cite>
<span class="author"><strong><?php comment_author_link() ?></strong></span>
<span class="date"><?php comment_date() ?></span>
<?php if ( (function_exists('gravatar')) ) { ?><span class="gravatar"><img src="<?php gravatar("R", 32, "http://utombox.com/wp-content/themes/4u/images/defaultgravatar.jpg"); ?>" alt="Gravatar" /></span><?php } ?>
</cite>
<div class="content">
<?php if ($comment->comment_approved == '0') : ?>
<em>Your comment is awaiting moderation.</em>
<?php endif; ?>
<?php comment_text() ?>
</div>
<div class="clear"></div>
</li>
<?php /* Changes every other comment to a different class */
if ('alt' == $oddcomment) $oddcomment = '';
else $oddcomment = 'alt';
?>
<?php endforeach; /* end for each comment */ ?>
</ol>
<?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 are closed.</p>
<?php endif; ?>
<?php endif; ?>
<?php if ('open' == $post->comment_status) : ?>
<h3 class="formhead">Post a Comment »</h3>
<div id="comment-form">
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be <strong><a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a></strong> to post a comment.</p>
<?php else : ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if ( $user_ID ) : ?>
<p>Logged in as <strong><a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a></strong>. <strong><a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout »</a></strong></p>
<?php else : ?>
<label class="text">Name:</label><br /><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" class="textfield" tabindex="1" /><br />
<label class="text">Email:</label><br /><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" class="textfield" tabindex="2" /><br />
<label class="text">Website:</label><br /><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" class="textfield" tabindex="3" /><br />
<?php endif; ?>
<label class="text">Comment:</label><br />
<textarea name="comment" id="comment" class="commentbox" tabindex="4" rows="8" cols="50"></textarea>
<div class="formactions">
<span style="visibility:hidden">Safari hates me</span>
<input type="submit" name="submit" tabindex="5" class="submit" value="Add Your Comment" />
</div>
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
<?php do_action('comment_form', $post->ID); ?>
</form>
</div>
<div id="comment-guide">
<h3>Comment Guidelines</h3>
<ul>
<li><a title="Get Gravatar" href="http://www.gravatar.com">Gravatars</a> are enabled </li>
<li>Hyperlinks are automatically generated. </li>
<li><em>italic</em> </li>
<li><strong>bold</strong> </li>
</ul>
</div>
<div class="clear"></div>
<?php endif; // If registration required and not logged in ?>
<?php endif; // if you delete this the sky will fall on your head ?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -