Advertisement
Digitalraindrops

comments_3

Jun 1st, 2011
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.35 KB | None | 0 0
  1. <div id="comments">
  2.     <!-- Prevents loading the file directly -->
  3.     <?php if(!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) : ?>
  4.         <?php die('Please do not load this page directly or we will hunt you down. Thanks and have a great day!'); ?>
  5.     <?php endif; ?>
  6.    
  7.     <!-- Password Required -->
  8.     <?php if(!empty($post->post_password)) : ?>
  9.         <?php if($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>
  10.         <?php endif; ?>
  11.     <?php endif; ?>
  12.    
  13.     <?php $i=0; ?><!-- Added by Digital Raindrops -->
  14.     <?php if($comments) : ?>
  15.         <h3><?php comments_number('No comments', 'One comment', '% comments'); ?></h3>
  16.         <ol>
  17.         <?php foreach($comments as $comment) : ?>
  18.             <?php $comment_type = get_comment_type(); ?> <!-- checks for comment type -->
  19.             <?php if($comment_type == 'comment') { ?> <!-- outputs only comments -->
  20.             <?php $i++; ?> <!-- variable for alternating comment styles -->
  21.             <li id="comment-<?php comment_ID(); ?>" class="comment <?php if($i&1) { echo 'odd';} else {echo 'even';} ?> <?php $user_info = get_userdata(1); if ($user_info->ID == $comment->user_id) echo 'authorComment'; ?> <?php if ($comment->user_id > 0) echo 'user-comment'; ?>">
  22.                     <?php if ($comment->comment_approved == '0') : ?> <!-- if comment is awaiting approval -->
  23.                         <p class="waiting-for-approval">
  24.                             <em>Your comment is awaiting approval.</em>
  25.                         </p>
  26.                     <?php endif; ?>
  27.                     <div class="comment-text">
  28.                         <?php comment_text(); ?>
  29.                     </div><!--.commentText-->
  30.                     <div class="comment-meta">
  31.                         <?php edit_comment_link('Edit Comment', '', ''); ?>
  32.                         <?php comment_type(); ?> by <?php comment_author_link(); ?> on <?php comment_date(); ?> at <?php comment_time(); ?>
  33.                         <p class="gravatar"><?php if(function_exists('get_avatar')) { echo get_avatar($comment, '36'); } ?></p>
  34.                     </div><!--.commentMeta-->
  35.                 </li>
  36.             <?php } else { $trackback = true; } ?>
  37.         <?php endforeach; ?>
  38.         </ol>
  39.         <?php if ($trackback == true) { ?><!-- checks for comment type: trackback -->
  40.         <h3>Trackbacks</h3>
  41.             <ol>
  42.                 <!-- outputs trackbacks -->
  43.                 <?php foreach ($comments as $comment) : ?>
  44.                     <?php $comment_type = get_comment_type(); ?>
  45.                     <?php if($comment_type != 'comment') { ?>
  46.                         <li><?php comment_author_link() ?></li>
  47.                     <?php } ?>
  48.                 <?php endforeach; ?>
  49.             </ol>
  50.         <?php } ?>
  51.     <?php else : ?>
  52.         <p>No comments yet. You should be kind and add one!</p>
  53.     <?php endif; ?>
  54.    
  55.     <div id="comments-form">
  56.         <?php if(comments_open()) : ?>
  57.             <?php if(get_option('comment_registration') && !$user_ID) : ?>
  58.                 <p>Our apologies, you must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p><?php else : ?>
  59.                 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
  60.                     <?php if($user_ID) : ?>
  61.                         <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Log out &raquo;</a></p>
  62.                     <?php else : ?>
  63.                         <p>
  64.                             Allowed HTML tags: <?php echo allowed_tags(); /* outputs the html tags that are allowed in comments */ ?>
  65.                         </p>
  66.                         <p>
  67.                             <label for="author"><small>Name <?php if($req) echo "(required)"; ?></small></label>
  68.                             <input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
  69.                         </p>
  70.                         <p>
  71.                             <label for="email"><small>Mail (will not be published) <?php if($req) echo "(required)"; ?></small></label>
  72.                             <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
  73.                         </p>
  74.                         <p>
  75.                             <label for="url"><small>Website</small></label>
  76.                             <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
  77.                         </p>
  78.                     <?php endif; ?>
  79.                     <p>
  80.                         <label for="comment"><small>Comment</small></label>
  81.                         <textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea>
  82.                     </p>
  83.                     <p>
  84.                         <input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
  85.                         <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
  86.                     </p>
  87.                     <?php do_action('comment_form', $post->ID); ?>
  88.                 </form>
  89.                 <p><small>By submitting a comment you grant <?php bloginfo('name'); ?> a perpetual license to reproduce your words and name/web site in attribution. Inappropriate and irrelevant comments will be removed at an admin’s discretion. Your email is used for verification purposes only, it will never be shared.</small></p>
  90.             <?php endif; ?>
  91.         <?php else : ?>
  92.             <p>The comments are closed.</p>
  93.         <?php endif; ?>
  94.     </div><!--#commentsForm-->
  95. </div><!--#comments-->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement