Hi,
I have a problem with my wordpress theme: everytime I click on a tag, a category, an archive etc... (archive.php), all of the posts being displayed have the same title and link to the same post. The posts are different (content) but all the post titles are the same, they are all the same as the title of the first post of each page.
I know the problem comes from the template because when I change it, I don't have this problem anymore. I spent a lot of time trying to figure out what the problem was by comparing with my other themes, but I s... at PHP :(
Here is my archive.php page:
<?php get_header(); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php if(function_exists('the_ratings')) { the_ratings(); } ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>
<h2 class="pagetitle">‘<?php single_cat_title(); ?>’ Category</h2>
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
<h2 class="pagetitle">Posts Tagged ‘<?php single_tag_title(); ?>’</h2>
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h2 class="pagetitle"><?php the_time('F jS, Y'); ?></h2>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h2 class="pagetitle"><?php the_time('F, Y'); ?></h2>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h2 class="pagetitle"><?php the_time('Y'); ?></h2>
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h2 class="pagetitle">Author Archive</h2>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h2 class="pagetitle">Blog Archives</h2>
<?php } ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1>
<div class="alignlefttt">Posted in <?php the_category(', ') ?> by <?php the_author() ?> <?php edit_post_link('Edit'); ?></div>
<div class="alignrighttt"><?php the_time('F jS, Y') ?></div>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
<p class="info"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
</div>
<?php comments_template(); ?>
<?php endwhile; ?>
<div class="alignrightttt"><?php next_posts_link('Next Products Page »') ?></div> <div class="alignleftttt"><?php previous_posts_link('« Previous Products Page') ?></div>
<?php else : ?>
<h1>Not Found</h1>
Sorry, but you are looking for something that isn't here.
<?php endif; ?>
<BR /><BR /><center><?php adrotate_banner('3,5,6'); ?></center>
</div>
<?php get_sidebar(); ?>
<div class="clearer"> </div>
</div>
<?php get_footer(); ?>
Thanks a lot for your help!