Advertisement
Guest User

comments.php

a guest
Jan 4th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.38 KB | None | 0 0
  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>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 = 'alt';
  18. ?>
  19. <?php if ( $comments ) : ?>
  20. <!-- You can start editing here. -->
  21.  
  22.             <?php $urlHome = get_bloginfo('template_directory'); ?>
  23.            
  24.             <div class="box post-comments" id="comments">
  25.                 <div class="content">
  26.                     <h2><?php comments_number('No Responses', 'One Response', '% Responses' );?></h2>
  27.                    
  28.                     <?php foreach ($comments as $comment) : ?>
  29.                      <div id="comment-<?php comment_ID() ?>" class="fl ar">
  30.                         <div class="pic"><?php echo get_avatar( $comment, 80, $default = $urlHome . '/images/default_avatar_visitor.gif' ); ?></div>
  31.                         <div class="comm-name"><a href="<?php comment_author_url(); ?>" target="_blank"><?php comment_author(); ?></a></div>
  32.                         <div class="comm-date"><small><em><?php comment_date('n.j.Y'); ?></em></small></div>
  33.                      </div>
  34.                      <div class="fr">
  35.                        <div class="box2 <?php echo $oddcomment; ?>">
  36.                          <?php comment_text() ?>
  37.                        </div><!--/box2 -->
  38.                      </div>
  39.                      <div class="fix"></div>
  40.                     <?php $oddcomment = ( empty( $oddcomment ) ) ? 'alt' : ''; ?>
  41.                     <?php endforeach; // end for each comment ?>
  42.                    
  43.                 </div><!--/content -->
  44.             </div><!--/box -->
  45. <?php endif; ?>
  46.  
  47.  
  48.             <?php if ('open' == $post->comment_status) : ?>
  49.             <div id="respond" class="box post-comments">
  50.                 <div class="content">
  51.                     <h2>Leave Your Response</h2>
  52.                    
  53.                     <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
  54.                     <p>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>
  55.                     <?php else : ?>
  56.                    
  57.                     <div class="fl">
  58.                         <div class="pic"><img src="<?php bloginfo('template_directory'); ?>/images/default_avatar_visitor.gif" alt="" /></div>
  59.                     </div>
  60.                     <div class="fr">
  61.                         <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
  62.                             <fieldset class="message">
  63.                             <?php if ( $user_ID ) : ?>
  64.                                 <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>
  65.                             <?php else : ?>
  66.                             <div>
  67.                                 <input name="author" id="author" type="text" value="Your Name" onclick="this.value='';" />
  68.                             </div>
  69.                             <div>
  70.                                 <input name="email" id="email" type="text" value="Your Email" onclick="this.value='';" />
  71.                             </div>
  72.                             <div>
  73.                                 <input name="url" id="url" type="text" value="Your Website" onclick="this.value='';" />
  74.                             </div>
  75.                             <?php endif; ?>
  76.                             <div class="textarea">
  77.                                 <textarea name="comment" id="comment" cols="" rows="">Your Comments</textarea>
  78.                             </div>
  79.                             <div class="submit">
  80.                                 <input name="submit" id="submit" type="image" src="<?php bloginfo('template_directory'); ?>/images/btn-submit.gif" value="Send" class="btn"  />
  81.                             </div>
  82.                             <div class="notice">* Name, Email, Comment are Required</div>
  83.                             <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
  84.                             <?php do_action('comment_form', $post->ID); ?>
  85.                             </fieldset>
  86.                         </form>
  87.                         <?php endif; // If registration required and not logged in ?>
  88.                     </div>
  89.                     <div class="fix"></div>
  90.                 </div>
  91.                 <!--/content -->
  92.             </div>
  93.             <!--/box -->
  94.             <?php endif; // if you delete this the sky will fall on your head ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement