Guest User

Untitled

a guest
Dec 29th, 2015
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.37 KB | None | 0 0
  1. <?php
  2.  
  3. //removing the comments sidewide
  4. if ((td_util::get_option('tds_disable_comments_sidewide') == '') && post_type_supports(get_post_type(), 'comments')) { ?>
  5.  
  6. <div class="comments" id="comments">
  7. <?php if (post_password_required()) { ?>
  8.  
  9. <?php } else {
  10.  
  11. // on Newspaper the css class 'td-pb-padding-side' is not applied
  12. $td_css_cls_pb_padding_side = '';
  13. $td_css_cls_block_title = '';
  14.  
  15. if ('Newsmag' == TD_THEME_NAME) {
  16. $td_css_cls_pb_padding_side = 'td-pb-padding-side';
  17. } else if ('Newspaper' == TD_THEME_NAME) {
  18. $td_css_cls_block_title = 'block-title';
  19. }
  20.  
  21. $num_comments = get_comments_number(); // get_comments_number returns only a numeric value
  22. if ($num_comments == 0) {
  23. $td_comments_no_text = __td('NO COMMENTS', TD_THEME_NAME);
  24. } elseif ($num_comments > 1) {
  25. $td_comments_no_text = $num_comments . ' ' . __td('COMMENTS', TD_THEME_NAME);
  26. } else {
  27. $td_comments_no_text = __td('1 COMMENT', TD_THEME_NAME);
  28. }
  29. ?>
  30.  
  31. <div class="td-comments-title-wrap <?php echo $td_css_cls_pb_padding_side ?>">
  32. <h4 class="<?php echo $td_css_cls_block_title ?>"><span><?php echo $td_comments_no_text?></span></h4>
  33. </div>
  34.  
  35. <?php if (have_comments()) { ?>
  36.  
  37. <ol class="comment-list <?php echo $td_css_cls_pb_padding_side ?>">
  38. <?php wp_list_comments(array('callback' => 'td_comment')); ?>
  39. </ol>
  40. <div class="comment-pagination">
  41. <?php previous_comments_link(); ?>
  42. <?php next_comments_link(); ?>
  43. </div>
  44.  
  45. <?php }
  46.  
  47. if (!comments_open() and (get_comments_number() > 0)) { ?>
  48. <p class="td-pb-padding-side"><?php _etd( 'Comments are closed.', TD_THEME_NAME ); ?></p>
  49. <?php }
  50.  
  51. $commenter = wp_get_current_commenter();
  52.  
  53. if (empty($aria_req)) {
  54. $aria_req = '';
  55. }
  56.  
  57. $fields = array(
  58. 'author' =>
  59. '<p class="comment-form-input-wrap">
  60. <span class="comment-req-wrap">
  61. <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>' : '' ) .
  62. '</p>',
  63.  
  64. 'email' =>
  65. '<p class="comment-form-input-wrap">
  66. <span class="comment-req-wrap"><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>' : '' ) .
  67. '</p>',
  68.  
  69. 'url' =>
  70. '<p class="comment-form-input-wrap">
  71. <input class="" id="url" name="url" placeholder="' . __td('Website:', TD_THEME_NAME) . '" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" />' .
  72. '</p>',
  73. );
  74.  
  75. $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields));
  76. $defaults['comment_field'] =
  77. '<div class="clearfix"></div>
  78. <p class="comment-form-input-wrap">
  79. <textarea placeholder="' . __td('Comment:', TD_THEME_NAME) . '" id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
  80. </p>';
  81.  
  82. $defaults['comment_notes_before'] = '';
  83. $defaults['comment_notes_after'] = '';
  84. $defaults['title_reply'] = __td('LEAVE A REPLY', TD_THEME_NAME);
  85. $defaults['label_submit'] = __td('Post Comment', TD_THEME_NAME);
  86. $defaults['cancel_reply_link'] = __td('Cancel reply', TD_THEME_NAME);
  87.  
  88. // login with our login modal when you want to write a comment
  89. if (td_util::get_option('tds_login_sign_in_widget') == 'show') {
  90. $defaults['must_log_in'] = '<p class="must-log-in"><a class="td-login-modal-js" data-effect="mpf-td-login-effect" href="#login-form">' . __td('Log in to leave a comment', TD_THEME_NAME) . ' </a></p>';
  91. }
  92.  
  93. comment_form($defaults);
  94. //comment_form();
  95.  
  96. } ?>
  97. </div> <!-- /.content -->
  98. <?php
  99. }
  100.  
  101.  
  102. //end removing the comments sidewide
  103. /**
  104. * Custom callback for outputting comments
  105. *
  106. * @return void
  107. * @author tagdiv
  108. */
  109. function td_comment( $comment, $args, $depth ) {
  110. $GLOBALS['comment'] = $comment;
  111.  
  112. $td_isPingTrackbackClass = '';
  113.  
  114. if($comment->comment_type == 'pingback') {
  115. $td_isPingTrackbackClass = 'pingback';
  116. }
  117.  
  118. if($comment->comment_type == 'trackback') {
  119. $td_isPingTrackbackClass = 'trackback';
  120. }
  121.  
  122. if (!empty($comment->comment_author_email)) {
  123. $td_comment_auth_email = $comment->comment_author_email;
  124. } else {
  125. $td_comment_auth_email = '';
  126. }
  127.  
  128. $td_article_date_unix = @strtotime("{$comment->comment_date_gmt} GMT");
  129. //print_r($td_article_date_unix);
  130.  
  131.  
  132. if ($comment->comment_approved == '1') { ?>
  133. <li class="comment <?php echo $td_isPingTrackbackClass ?>" id="li-comment-<?php comment_ID() ?>">
  134. <article>
  135. <footer>
  136. <?php
  137. //echo get_template_directory_uri() . "/images/avatar.jpg";
  138. //echo get_avatar($td_comment_auth_email, 50, get_template_directory_uri() . "/images/avatar.jpg");
  139. echo get_avatar($td_comment_auth_email, 50);
  140. ?>
  141. <cite><?php comment_author_link() ?></cite>
  142.  
  143. <a class="comment-link" href="#li-comment-<?php comment_ID() ?>">
  144. <time pubdate="<?php echo $td_article_date_unix ?>"><?php comment_date() ?> at <?php comment_time() ?></time>
  145. </a>
  146. </footer>
  147.  
  148. <div class="comment-content">
  149. <?php comment_text() ?>
  150. </div>
  151.  
  152. <div class="comment-meta" id="comment-<?php comment_ID() ?>">
  153. <?php comment_reply_link(array_merge( $args, array(
  154. 'depth' => $depth,
  155. 'max_depth' => $args['max_depth'],
  156. 'reply_text' => __td('Reply', TD_THEME_NAME),
  157. 'login_text' => __td('Log in to leave a comment', TD_THEME_NAME)
  158. )))
  159. ?>
  160. </div>
  161. </article>
  162. <?php
  163. }?>
  164. <?php if ($comment->comment_approved == '0') : ?>
  165. <li class="comment <?php echo $td_isPingTrackbackClass ?>" id="li-comment-<?php comment_ID() ?>">
  166. <article>
  167. <footer>
  168. <?php
  169. //echo get_template_directory_uri() . "/images/avatar.jpg";
  170. //echo get_avatar($td_comment_auth_email, 50, get_template_directory_uri() . "/images/avatar.jpg");
  171. echo get_avatar($td_comment_auth_email, 50);
  172. ?>
  173. <cite><?php comment_author_link() ?></cite>
  174.  
  175. <a class="comment-link" href="#li-comment-<?php comment_ID() ?>">
  176. <time pubdate="<?php echo $td_article_date_unix ?>"><?php comment_date() ?> at <?php comment_time() ?></time>
  177. </a>
  178. </footer>
  179. </article>
  180. (Your comment is awaiting moderation.)
  181. <?php endif; ?>
  182.  
  183. <?php
  184. }
  185. ?>
Advertisement
Add Comment
Please, Sign In to add comment