Advertisement
Guest User

comments.php

a guest
Nov 11th, 2011
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.38 KB | None | 0 0
  1.         <div id="comments">
  2. <?php
  3.     $req = get_option('require_name_email'); // Checks if fields are required. Thanks, Adam. ;-)
  4.     if ( 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']) )
  5.         die ( 'Please do not load this page directly. Thanks!' );
  6.     if ( ! empty($post->post_password) ) :
  7.         if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) :
  8. ?>
  9.                 <div class="nopassword"><?php _e('This post is password protected. Enter the password to view any comments.', 'sandbox') ?></div>
  10.             </div><!-- .comments -->
  11. <?php
  12.         return;
  13.     endif;
  14. endif;
  15. ?>
  16. <?php if ( $comments ) : ?>
  17. <?php global $sandbox_comment_alt ?>
  18.  
  19. <?php /* numbers of pings and comments */
  20. $ping_count = $comment_count = 0;
  21. foreach ( $comments as $comment )
  22.     get_comment_type() == "comment" ? ++$comment_count : ++$ping_count;
  23. ?>
  24. <?php if ( $comment_count ) : ?>
  25. <?php $sandbox_comment_alt = 0 ?>
  26.  
  27.                 <div id="comments-list" class="comments">
  28.                     <h3><?php printf($comment_count > 1 ? __('<span>%d</span> Comments', 'sandbox') : __('<span>One</span> Comment', 'sandbox'), $comment_count) ?></h3>
  29.  
  30.                     <ol>
  31. <?php foreach ($comments as $comment) : ?>
  32. <?php if ( get_comment_type() == "comment" ) : ?>
  33.                         <li id="comment-<?php comment_ID() ?>" class="<?php sandbox_comment_class() ?>">
  34.                             <div class="comment-author vcard"><span class="fn n"><?php comment_author_link() ?></span></div>
  35.                             <div class="comment-meta"><?php printf(__('Posted %1$s at %2$s <span class="meta-sep">|</span> <a href="%3$s" title="Permalink to this comment">Permalink</a>', 'sandbox'),
  36.                                         get_comment_date(),
  37.                                         get_comment_time(),
  38.                                         '#comment-' . get_comment_ID() );
  39.                                         edit_comment_link(__('Edit', 'sandbox'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>'); ?></div>
  40. <?php if ($comment->comment_approved == '0') _e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'sandbox') ?>
  41.                             <?php comment_text() ?>
  42.                         </li>
  43. <?php endif; /* if ( get_comment_type() == "comment" ) */ ?>
  44. <?php endforeach; ?>
  45.  
  46.                     </ol>
  47.                 </div><!-- #comments-list .comments -->
  48.  
  49. <?php endif; /* if ( $comment_count ) */ ?>
  50. <?php if ( $ping_count ) : ?>
  51. <?php $sandbox_comment_alt = 0 ?>
  52.  
  53.                 <div id="trackbacks-list" class="comments">
  54.                     <h3><?php printf($ping_count > 1 ? __('<span>%d</span> Trackbacks', 'sandbox') : __('<span>One</span> Trackback', 'sandbox'), $ping_count) ?></h3>
  55.  
  56.                     <ol>
  57. <?php foreach ( $comments as $comment ) : ?>
  58. <?php if ( get_comment_type() != "comment" ) : ?>
  59.  
  60.                         <li id="comment-<?php comment_ID() ?>" class="<?php sandbox_comment_class() ?>">
  61.                             <div class="comment-author"><?php printf(__('By %1$s on %2$s at %3$s', 'sandbox'),
  62.                                     get_comment_author_link(),
  63.                                     get_comment_date(),
  64.                                     get_comment_time() );
  65.                                     edit_comment_link(__('Edit', 'sandbox'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>'); ?></div>
  66. <?php if ($comment->comment_approved == '0') _e('\t\t\t\t\t<span class="unapproved">Your trackback is awaiting moderation.</span>\n', 'sandbox') ?>
  67.                             <?php comment_text() ?>
  68.                         </li>
  69. <?php endif /* if ( get_comment_type() != "comment" ) */ ?>
  70. <?php endforeach; ?>
  71.  
  72.                     </ol>
  73.                 </div><!-- #trackbacks-list .comments -->
  74.  
  75. <?php endif /* if ( $ping_count ) */ ?>
  76. <?php endif /* if ( $comments ) */ ?>
  77. <?php if ( 'open' == $post->comment_status ) : ?>
  78.                 <div id="respond">
  79.                     <h3><?php _e('Post a Comment', 'sandbox') ?></h3>
  80.  
  81. <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
  82.                     <p id="login-req"><?php printf(__('You must be <a href="%s" title="Log in">logged in</a> to post a comment.', 'sandbox'),
  83.                     get_option('siteurl') . '/wp-login.php?redirect_to=' . get_permalink() ) ?></p>
  84.  
  85. <?php else : ?>
  86.                     <div class="formcontainer">
  87. <?php do_action('comment_form_before'); ?>
  88.                         <form id="commentform" action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post">
  89.  
  90. <?php if ( $user_ID ) : ?>
  91.                             <p id="login"><?php printf(__('<span class="loggedin">Logged in as <a href="%1$s" title="Logged in as %2$s">%2$s</a>.</span> <span class="logout"><a href="%3$s" title="Log out of this account">Log out?</a></span>', 'sandbox'),
  92.                                 get_option('siteurl') . '/wp-admin/profile.php',
  93.                                 wp_specialchars($user_identity, true),
  94.                                 get_option('siteurl') . '/wp-login.php?action=logout&amp;redirect_to=' . get_permalink() ) ?></p>
  95.  
  96. <?php else : ?>
  97.  
  98.                             <p id="comment-notes"><?php _e('Your email is <em>never</em> published nor shared.', 'sandbox') ?> <?php if ($req) _e('Required fields are marked <span class="required">*</span>', 'sandbox') ?></p>
  99.  
  100.                             <div class="form-label"><label for="author"><?php _e('Name', 'sandbox') ?></label> <?php if ($req) _e('<span class="required">*</span>', 'sandbox') ?></div>
  101.                             <div class="form-input"><input id="author" name="author" type="text" value="<?php echo $comment_author ?>" size="30" maxlength="20" tabindex="3" /></div>
  102.  
  103.                             <div class="form-label"><label for="email"><?php _e('Email', 'sandbox') ?></label> <?php if ($req) _e('<span class="required">*</span>', 'sandbox') ?></div>
  104.                             <div class="form-input"><input id="email" name="email" type="text" value="<?php echo $comment_author_email ?>" size="30" maxlength="50" tabindex="4" /></div>
  105.  
  106.                             <div class="form-label"><label for="url"><?php _e('Website', 'sandbox') ?></label></div>
  107.                             <div class="form-input"><input id="url" name="url" type="text" value="<?php echo $comment_author_url ?>" size="30" maxlength="50" tabindex="5" /></div>
  108.  
  109. <?php endif /* if ( $user_ID ) */ ?>
  110.  
  111.                             <div class="form-label"><label for="comment"><?php _e('Comment', 'sandbox') ?></label></div>
  112.                             <div class="form-textarea"><textarea id="comment" name="comment" cols="45" rows="8" tabindex="6"></textarea></div>
  113.  
  114.                             <div class="form-submit"><input id="submit" name="submit" type="submit" value="<?php _e('Post Comment', 'sandbox') ?>" tabindex="7" /><input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /></div>
  115.  
  116.                             <?php do_action('comment_form', $post->ID); ?>
  117.  
  118.                         </form><!-- #commentform -->
  119. <?php do_action('comment_form_after'); ?>
  120.                     </div><!-- .formcontainer -->
  121. <?php endif /* if ( get_option('comment_registration') && !$user_ID ) */ ?>
  122.  
  123.                 </div><!-- #respond -->
  124. <?php endif /* if ( 'open' == $post->comment_status ) */ ?>
  125.  
  126.             </div><!-- #comments -->
  127.  
  128.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement