• I’m trying to list a 10 posts from a specific category I have on my blog, above the regular blog posts. So I added this extra loop:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <h3 class=”storytitle”>” rel=”bookmark”><?php the_title(); ?></h3>
    <div class=”expiration”>
    <?php if (has_expiration_date()): ?>
    <?php if (has_expired()): ?>
    <br/><b><font color=”blue”>This offer has expired</font></b>
    <?php else: ?>

    <?php endif; ?>
    <?php endif; ?>
    </div>

    So the first loop runs fine, but on the regular posts I get this I get this error in just about every post:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘AND comment_approved = ‘1” at line 1]
    SELECT COUNT(comment_ID) FROM blog_wp_comments WHERE comment_post_ID = AND comment_approved = ‘1’;

    Any help would be greatly appreciated!

  • The topic ‘Listing last five posts of a specific category on home page’ is closed to new replies.