Support » Fixing WordPress » “get_posts” with date and comments?

  • First, the post date does not display.
    Second, the comments part comes up with a huge MySQL error.
    In my code I’m using this….

    <div id="rightpost"><br>
    <?php
    $posts = get_posts('numberposts=3&offset=0');
    foreach ($posts as $post) :
    ?>
    <h3>"><?php the_title() ?></h3>
    <div class="storycontent">
    <?php the_excerpt() ?>
    </div>
    <div class="feedback">
    <?php the_date() ?> |
    <?php wp_link_pages(); ?>
    <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
    </div>
    <br>
    <?php
    endforeach;
    ?>
    </div>
    '
    This is the error...

    ‘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 wp_comments WHERE comment_post_ID = AND comment_approved = ‘1’;
    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(*) FROM wp_comments WHERE comment_post_ID = AND comment_approved = ‘1’
    `
    Any ideas on what i should change the code to?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.