Advertisement
Guest User

Hype Comments

a guest
Apr 3rd, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.89 KB | None | 0 0
  1. <div id="comments-block">
  2.     <?php
  3.  
  4.     // Do not delete these lines
  5.     if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
  6.     die ('Please do not load this page directly. Thanks!');
  7.  
  8.     if ( post_password_required() ) { ?>
  9.     <p class="nocomments">This post is password protected. Enter the password to view comments.</p>
  10.     <?php
  11.     return;
  12.     }
  13.     ?>
  14.  
  15.     <!-- You can start editing here. -->
  16.  
  17.     <?php if ( have_comments() ) :
  18.         $comments_count = separate_comments(get_comments('post_id='. get_the_ID()));
  19.         $comment_count = count($comments_count['comment']);
  20.         if($comment_count==0) {
  21.             $cc_display='No Comments';
  22.         } else if($comment_count==1) {
  23.             $cc_display='1 Comment';           
  24.         } else {
  25.             $cc_display="$comment_count Comments";
  26.         }
  27.     ?>
  28.        
  29.     <div class="comment-info"><?php echo $cc_display; ?> to &#8220;<?php the_title(); ?>&#8221;</div>
  30.  
  31.     <ol class="comments-list">
  32.     <?php wp_list_comments('type=comment&callback=hype_comment'); ?>
  33.     </ol>
  34.  
  35.     <div class="comment-nav hype-btn">
  36.     <div class="comment-nav-left"><?php previous_comments_link() ?></div>
  37.     <div class="comment-nav-right"><?php next_comments_link() ?></div>
  38.     </div>
  39.     <?php if ('closed' == $post->comment_status) : ?>
  40.         <p class="nocomments">Comments are closed.</p>
  41.     <?php endif; ?>
  42.    
  43.     <?php else : // this is displayed if there are no comments so far ?>
  44.  
  45.     <?php if ('open' == $post->comment_status) : ?>
  46.     <!-- If comments are open, but there are no comments. -->
  47.  
  48.     <?php else : // comments are closed ?>
  49.        
  50.     <?php if (is_single()) : ?>
  51.     <!-- If comments are closed. -->
  52.     <p class="nocomments">Comments are closed.</p>
  53.  
  54.     <?php endif; ?>
  55.     <?php endif; ?>
  56.     <?php endif; ?>
  57.  
  58.  
  59.     <?php if ('open' == $post->comment_status) : ?>
  60.  
  61.     <div id="respond">
  62.  
  63.     <h3><?php comment_form_title( 'Leave a Comment', 'Leave a Reply to %s' ); ?></h3>
  64.  
  65.     <div class="cancel-comment-reply">
  66.     <small><?php cancel_comment_reply_link(); ?></small>
  67.     </div>
  68.  
  69.     <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
  70.     <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>
  71.     <?php else : ?>
  72.  
  73.     <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
  74.  
  75.     <?php if ( $user_ID ) : ?>
  76.        
  77.     <div class="comment-author vcard leave-comment-author">
  78.     <div class="comment-avatar"><?php echo get_avatar(get_the_author_meta('user_email'), $size = '64'); ?></div><div class="comment-author-name-reply comment-text"> Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account" class="logout-btn">Log out &raquo;</a></div></div>
  79.  
  80.     <?php else : ?>
  81.  
  82.     <p><label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
  83.     </p>
  84.  
  85.     <p><label for="email"><small>E-Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
  86.     </p>
  87.  
  88.     <p><label for="url"><small>Website</small></label><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
  89.     </p>
  90.  
  91.     <?php endif; ?>
  92.  
  93.     <div class="comment-textarea">
  94.         <p><textarea name="comment" id="comment" cols="50" rows="10" tabindex="4"></textarea></p>
  95.  
  96.         <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
  97.         <?php comment_id_fields(); ?>
  98.         </p>
  99.         <?php do_action('comment_form', $post->ID); ?>     
  100.         <p style="text-align:left;font-size:0.9em;color:#999;">You can use these tags: <code><?php echo allowed_tags(); ?></code></p>
  101.     </div>
  102.  
  103.     </form>
  104.  
  105.     <?php endif; // If registration required and not logged in ?>
  106.     </div>
  107.     <div id="comment-trackbacks">
  108.         <div id="tb-header" class="clearfix">
  109.             <?php
  110.                 $trackback_count = count($comments_count['trackback']);
  111.                 $pingback_count = count($comments_count['pingback']);
  112.                 if(($trackback_count!=0) || ($pingback_count!=0)) {
  113.                     $tb_title = "<h4>";
  114.                     if($trackback_count!=0){
  115.                         $tb_title .= "$trackback_count Trackbacks";
  116.                     }
  117.                     if(($trackback_count!=0) && ($pingback_count!=0)) {
  118.                         $tb_title .= " / ";
  119.                     }
  120.                     if($pingback_count!=0){
  121.                         $tb_title .= "$pingback_count Pingbacks";
  122.                     }
  123.                     $tb_title .= "</h4>";                  
  124.                 } else {
  125.                     $tb_title = '&nbsp;';
  126.                 }
  127.              ?>
  128.             <div id="tb-title">
  129.                 <?php echo $tb_title; ?>
  130.             </div>
  131.             <div id="tb-url"><a href="<?php trackback_url(); ?>">Get a Trackback Link</a></div>        
  132.         </div>
  133.         <div id="tb-list">
  134.                 <?php
  135.                 if(($trackback_count!=0) || ($pingback_count!=0)) {
  136.                     ?>
  137.                         <ol class="comments-trackback-list">
  138.                        
  139.                     <?php
  140.                     foreach($comments_count['pings'] as $tb) {
  141.                             $tb_content = strip_tags($tb->comment_content);
  142.                             $tb_url = $tb->comment_author_url;
  143.                             $tb_author = $tb->comment_author;
  144.                             $tb_date = strtotime($tb->comment_date);
  145.                             $tb_date = date('F j, Y \a\t H:i:s',$tb_date);
  146.                             $tb_type = $tb->comment_type;
  147.                         ?>
  148.                            <li <?php comment_class(); ?> id="li-trackback-<?php comment_ID() ?>"><span class="comment-tb-date"><?php echo $tb_date; ?></span><br /> <span class="tb-type"><?php echo $tb_type ?>:</span> <span class="tb-author"><a href="<?php echo $tb_url ?>" target="_blank"><?php echo $tb_author;  ?></a></span> - <span class="comment-tb-content"><?php echo $tb_content; ?></span></li>
  149.                         <?php
  150.                     }
  151.                    
  152.                     ?>
  153.                         </ol>
  154.                     <?php
  155.                 } ?>
  156.         </div>
  157.     </div>
  158.  
  159.     <?php endif; // if you delete this the sky will fall on your head ?>
  160.    
  161. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement