Guest User

Untitled

a guest
May 4th, 2014
192
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //removing the comments sidewide
  3. if(td_util::get_option('tds_disable_comments_sidewide') == '') {?>
  4. <div class="comments" id="comments">
  5. <?php if (post_password_required()) { ?>
  6.  
  7. <?php } else { ?>
  8. <?php if (comments_open() ) { ?>
  9. <div class="comments-title-wrap">
  10. <?php
  11. $num_comments = get_comments_number(); // get_comments_number returns only a numeric value
  12. if ( $num_comments == 0 ) {
  13. $td_comments_no_text = __td('NO COMMENTS');
  14. } elseif ( $num_comments > 1 ) {
  15. $td_comments_no_text = $num_comments . ' ' . __td('COMMENTS');
  16. } else {
  17. $td_comments_no_text = __td('1 COMMENT');
  18. }
  19. ?>
  20. <h4 class="block-title"><span><?php echo $td_comments_no_text?></span></h4>
  21. </div>
  22.  
  23. <?php if (have_comments()) { ?>
  24. <ol class="comment-list">
  25. <?php wp_list_comments( array( 'callback' => 'td_comment' ) ); ?>
  26. </ol>
  27. <div class="comment-pagination">
  28. <?php paginate_comments_links(); ?>
  29. </div>
  30. <?php } ?>
  31. <?php } ?>
  32. <?php
  33.  
  34. $commenter = wp_get_current_commenter();
  35.  
  36. if (empty($aria_req)) {
  37. $aria_req = '';
  38. }
  39. $fields = array(
  40. 'author' =>
  41. '<p class="comment-form-input-wrap">
  42. <span class="comment-req-wrap needsclick"><input class="" id="author" name="author" placeholder="' . __td('Name:', TD_THEME_NAME) . '" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' />' . ( $req ? '</span>' : '' ) .
  43. '</p>',
  44.  
  45. 'email' =>
  46. '<p class="comment-form-input-wrap">
  47. <span class="comment-req-wrap needsclick"><input class="" id="email" name="email" placeholder="' . __td('Email:', TD_THEME_NAME) . '" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' />' . ( $req ? '</span>' : '' ) .
  48. '</p>',
  49.  
  50. 'url' =>
  51. '<p class="comment-form-input-wrap needsclick">
  52. <input class="" id="url" name="url" placeholder="' . __td('Website:', TD_THEME_NAME) . '" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" />' .
  53. '</p>',
  54. );
  55.  
  56. $defaults = array(
  57. 'fields' => apply_filters('comment_form_default_fields', $fields ),
  58. );
  59.  
  60. $defaults['comment_field'] = '<div class="clearfix"></div><p class="comment-form-input-wrap"><textarea class="needsclick" placeholder="' . __td('Comment:', TD_THEME_NAME) . '" id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>';
  61.  
  62. $defaults['comment_notes_before'] = '';
  63. $defaults['comment_notes_after'] = '';
  64. $defaults['title_reply'] = __td('Leave a Reply');
  65. $defaults['label_submit'] = __td('Post Comment');
  66. $defaults['cancel_reply_link'] = __td('Cancel reply');
  67.  
  68. comment_form($defaults);
  69. //comment_form();
  70.  
  71. ?>
  72. <?php } ?>
  73. </div> <!-- /.content -->
  74.  
  75. <?php
  76. }//end removing the comments sidewide
  77. /**
  78. * Custom callback for outputting comments
  79. *
  80. * @return void
  81. * @author tagdiv
  82. */
  83. function td_comment( $comment, $args, $depth ) {
  84. $GLOBALS['comment'] = $comment;
  85.  
  86. $td_isPingTrackbackClass = '';
  87.  
  88. if($comment->comment_type == 'pingback') {
  89. $td_isPingTrackbackClass = 'pingback';
  90. }
  91.  
  92. if($comment->comment_type == 'trackback') {
  93. $td_isPingTrackbackClass = 'trackback';
  94. }
  95.  
  96. if (!empty($comment->comment_author_email)) {
  97. $td_comment_auth_email = $comment->comment_author_email;
  98. } else {
  99. $td_comment_auth_email = '';
  100. }
  101.  
  102. $td_article_date_unix = @strtotime("{$comment->comment_date_gmt} GMT");
  103. //print_r($td_article_date_unix);
  104. ?>
  105. <?php if ( $comment->comment_approved == '1' ) { ?>
  106. <li class="comment <?php echo $td_isPingTrackbackClass ?>" id="li-comment-<?php comment_ID() ?>">
  107. <article>
  108. <footer>
  109. <?php
  110. //echo get_template_directory_uri() . "/images/avatar.jpg";
  111. //echo get_avatar($td_comment_auth_email, 50, get_template_directory_uri() . "/images/avatar.jpg");
  112. echo get_avatar($td_comment_auth_email, 50); ?>
  113. <cite><?php comment_author_link() ?></cite>
  114.  
  115. <a class="comment-link" href="#li-comment-<?php comment_ID() ?>">
  116. <time pubdate="<?php echo $td_article_date_unix ?>"><?php comment_date() ?> at <?php comment_time() ?></time>
  117. </a>
  118.  
  119. </footer>
  120. <div class="comment-content">
  121. <?php comment_text() ?>
  122.  
  123. </div>
  124. <div class="comment-meta" id="comment-<?php comment_ID() ?>">
  125. <?php comment_reply_link(array_merge( $args, array(
  126. 'depth' => $depth,
  127. 'max_depth' => $args['max_depth'],
  128. 'reply_text' => __td('Reply', TD_THEME_NAME),
  129. 'login_text' => __td('Log in to leave a comment', TD_THEME_NAME)
  130. )))
  131. ?>
  132. </div>
  133.  
  134. </article>
  135. </li>
  136. <?php
  137. }
  138. }
  139. ?>
RAW Paste Data