Don't like ads? PRO users don't see any ads ;-)
Guest

Comments.php 2 code for Dragonskin

By: a guest on May 5th, 2012  |  syntax: PHP  |  size: 2.03 KB  |  hits: 64  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php // Do not delete these lines
  2.         if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
  3.                 die ('Please do not load this page directly. Thanks!');
  4.  
  5.         if (!empty($post->post_password)) { // if there's a password
  6.                 if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
  7.                         ?>
  8.  
  9.                         <p class="nocomments">This post is password protected. Enter the password to view comments.</p>
  10.  
  11.                         <?php
  12.                         return;
  13.                 }
  14.         }
  15.  
  16.         /* This variable is for alternating comment background */
  17.         $oddcomment = 'class="alt" ';
  18. ?>
  19.  
  20. <!-- You can start editing here. -->
  21.  
  22. <?php if ($comments) : ?>
  23.         <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to &#8220;<?php the_title(); ?>&#8221;</h3>
  24.  
  25.         <ol class="commentlist">
  26.  
  27.         <?php foreach ($comments as $comment) : ?>
  28.  
  29.                 <li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>">
  30.                         <?php echo get_avatar( $comment, 32 ); ?>
  31.                         <cite><?php comment_author_link() ?></cite> Says:
  32.                         <?php if ($comment->comment_approved == '0') : ?>
  33.                         <em>Your comment is awaiting moderation.</em>
  34.                         <?php endif; ?>
  35.                         <br />
  36.  
  37.                         <small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('edit','&nbsp;&nbsp;',''); ?></small>
  38.  
  39.                         <?php comment_text() ?>
  40.  
  41.                 </li>
  42.  
  43.         <?php
  44.                 /* Changes every other comment to a different class */
  45.                 $oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';
  46.         ?>
  47.  
  48.         <?php endforeach; /* end for each comment */ ?>
  49.  
  50.         </ol>
  51.  
  52.  <?php else : // this is displayed if there are no comments so far ?>
  53.  
  54.         <?php if ('open' == $post->comment_status) : ?>
  55.                 <!-- If comments are open, but there are no comments. -->
  56.  
  57.          <?php else : // comments are closed ?>
  58.                 <!-- If comments are closed. -->
  59.                 <?php if ( ! is_page() ) { ?>
  60.                 <p class="nocomments">Comments are closed.</p>
  61.                 <?php } ?>
  62.  
  63.         <?php endif; ?>
  64. <?php endif; ?>
  65.  
  66. <?php comment_form(); ?>