Guest User

Untitled

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