WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Archives Displaying Same Posts (2 posts)

  1. myaleigh
    Member
    Posted 3 years ago #

    Hi All -

    Can anyone give me an idea on what might be causing my archives page to show the same posts no matter what month you click on? The permalink is correct for example http://www.domain.com/2010/05/ but the posts displayed are the same as the blog's main page.

    I'm wondering if has to do with how I'm calling the posts in on the main page since I'm excluding certain categories. This is the code I used on the blog's main page.

    <?php query_posts('cat=-3,-4&posts_per_page=7'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="entry">
    <h2><a href="<?php the_permalink() ?>" style="color:#000000;"><?php the_title(); ?></a></h2>
    <p class="date"><?php the_time('l, F jS, Y') ?></p>
    <?php the_content('<p>Read More &raquo;</p>'); ?>
    </div><hr />
    <?php endwhile; else: ?>
    <?php endif; ?>
    <?php wp_reset_query(); ?>

    I'm using the default Archives widget to list the archives. I haven't setup a custom Archives template though so is that possibly the reason?

    Thanks for any clues/help you can give.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    Try changing:

    <?php query_posts('cat=-3,-4&posts_per_page=7'); ?>

    to:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('cat=-3,-4&posts_per_page=7&paged='.$paged); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic