Main index: #comments problem
-
My index displays the most recent post (in full), followed by 4 excerpts. In between there’s a kind of “middle bar”.
The problem is that the comment_popup_link does not display the number of comments correctly: it keeps on saying “0”.
Here’s my code:
<?php get_header(); ?><div id="content">
<?php if (have_posts()) : ?>
<?php query_posts('posts_per_page=1'); ?>
<?php while (have_posts()) : the_post(); ?><div id="post" class="post-<?php the_ID(); ?>">
<div class="post_header">
<h2>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>
<p class="post_data"><?php the_time('j F Y') ?> | <span class="reacties"><?php comments_popup_link('0', '1', '%'); ?></span> | <?php the_category(', ') ?> <?php edit_post_link('Edit', '| ', ''); ?>
</div><div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
</div><?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
</div><?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.
<?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?>
<?php get_sidebar(); ?>
<?php
$posts = get_posts('numberposts=6&offset=1');
foreach ($posts as $post) :
?>
<div class="posts_excerpts">
<div class="post_header">
<h2>"><?php the_title() ?></h2>
<p class="post_data"><?php the_time('j F Y') ?> | <span class="reacties"><?php comments_popup_link('0 ', '1 ', '%'); ?></span> | <?php the_category(', ') ?> <?php edit_post_link('Edit', '| ', ''); ?>
</div>
<div class="entry"><?php the_excerpt(); ?></div>
</div><?php
endforeach;
?></div><!-- end content -->
<?php get_footer(); ?>
The topic ‘Main index: #comments problem’ is closed to new replies.