Support » Plugins and Hacks » Why is not showing the last 5 comments

Why is not showing the last 5 comments

  • I have this code which shows the last 5 comments. Since the plugin is actually importing the facebook comments on my DB. Why is not working this script?

    <div class="tabs-post">
    //show recent comments
    $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type, comment_author_url, SUBSTRING(comment_content,1,70) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT 5";
    $comments = $wpdb->get_results($sql);
    foreach ($comments as $comment) :
    <div class="tab_inside">
    <a>ID); ?>#comment-<?php echo $comment->comment_ID; ?>"><?php echo get_avatar( $comment, '53' ); ?></a>
    <div class="content"><h1><a>ID); ?>#comment-<?php echo $comment->comment_ID; ?>"><?php echo $comment->post_title; ?></a></h1>  <span class="date"><?php echo strip_tags($comment->com_excerpt); ?></span></div><!-- #content closer -->
    </div><!-- #tab_inside -->
    <?php endforeach; ?>
    <?php wp_reset_query(); ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]


Viewing 1 replies (of 1 total)
  • It only shows the comments done directly from the WP form or from another plugin which is importing comments from my facebook publications. Why this not?

Viewing 1 replies (of 1 total)
  • The topic ‘Why is not showing the last 5 comments’ is closed to new replies.