Problem getting comments

  • Unknown's avatar

    Hi all,
    I’m in the process of creating my blog, and have got to displaying comments. What I’m trying to do is get my post displayed, and then a link to view the post in full. I’m having trouble with my foreach statement.

    Warning: Invalid argument supplied for foreach() in /home2/blackac2/public_html/wp-content/themes/ba/index.php on line 24

    Here’s my theme code:
    <?php while(have_posts()) : the_post(); ?>

    <?php the_content(); ?>
    <p align=”right”>
    <?php foreach($comments as $comment){?>
    <?php $i = 0; ?>
    <?php $i++; ?>
    “><?php echo $i; ?> comments
    <?php } ?>
    <?php endwhile; ?>

    It’s having trouble with the foreach line for some reason. Can someone tell me how to fix it :)

    Cheers

  • Unknown's avatar

    You did not specify a blog address or reason for posting when you created this topic.

    This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.

    If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.

    If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.

    This is an automated message.

  • The topic ‘Problem getting comments’ is closed to new replies.