Guest User

Untitled

a guest
Apr 25th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1. <?php
  2.  
  3. $comment_posts = get_option('woo_comment_posts');
  4. if (empty($comment_posts) || $comment_posts < 1) $comment_posts = 5;
  5.  
  6. global $wpdb;
  7.  
  8. $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,
  9. comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved,
  10. comment_type,comment_author_url,
  11. SUBSTRING(comment_content,1,50) AS com_excerpt
  12. FROM $wpdb->comments
  13. LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID =
  14. $wpdb->posts.ID)
  15. WHERE comment_approved = '1' AND comment_type = '' AND
  16. post_password = ''
  17. ORDER BY comment_date_gmt DESC LIMIT ".$comment_posts;
  18.  
  19. $comments = $wpdb->get_results($sql);
  20. $output = $pre_HTML;
  21.  
  22. foreach ($comments as $comment) {
  23.  
  24.  
  25. ?>
  26. <li>
  27. <?php echo get_avatar( $comment, '35' ); ?>
  28.  
  29. <a href="<?php echo get_permalink($comment->ID); ?>#comment-<?php echo $comment->comment_ID; ?>" title="<?php _e('on ',woothemes); ?> <?php echo $comment->post_title; ?>">
  30. <?php echo strip_tags($comment->comment_author); ?>: <?php echo strip_tags($comment->com_excerpt); ?>...
  31. </a>
  32. <div style="clear:both"></div>
  33. </li>
  34. <?php
  35. }
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment