• Resolved ceragraves

    (@ceragraves)


    I’m having trouble with the older posts link at the bottom of my blog. It had been working just fine when I originally set it up, but I just noticed that now when you click to view older posts the url changes, but the posts remain the same.

    I know there are other messages here about this problem and have tried using those solutions, but they haven’t worked for me.

    My blog is: http://www.sarahnicklin.com/blog

    To add to the weirdness, I’m using a category as a main page on the site also (www.sarahnicklin.com/category/news/) with a different design and the older posts link there works just fine – it’s just in the main blog that it’s not working.

    If it makes any difference, I am excluding category 4 from the main blog.

    Here is the code from the home blog page (Note: that this is a tweaked version the “notepad chaos” theme)

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
        <div class="post" id="post-<?php the_ID(); ?>">
          <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
          <div class="post-inner">
            <div class="date-tab"><span class="month"><?php the_time('F') ?></span><span class="day"><?php the_time('j') ?></span></div>
            <div class="thumbnail"><?php $key="thumbnail"; echo get_post_meta($post->ID, $key, true); ?></div>
    		<?php the_content('Read the rest of this entry &raquo;'); ?>
          </div>
          <div class="meta"><?php the_tags('Tags: ', ', ', '<br />'); ?>posted under <?php the_category(', ') ?> |  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></div>
        </div>
        <?php endwhile; ?>
        <div class="post-nav"><span class="previous"><?php next_posts_link('&laquo; Older Entries') ?></span><span class="next"><?php previous_posts_link('Newer Entries &raquo;') ?></span></div>
        <?php else : ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Are you using query_posts before that Loop?

    Thread Starter ceragraves

    (@ceragraves)

    yes I am. I just tested it by removing the query post that removes category 4 from the blog and then the blog works fine, so it’s something to do with that custom code that hides the category.

    Thread Starter ceragraves

    (@ceragraves)

    AH HA! Figured it out!! Thank you for the link to the query post – that really helped!!

    The problem was that I had 7 categories in total and all of the categories were going to the blog except one, which is what I wanted – the blog to show all categories except for one. In order to achieve that, I was removing that category from the blog, which is what was causing the problem:
    <?php query_posts('cat=-4'); ?>

    To fix this, I created another category and set it to be the parent for the 6 categories that I wanted to show on the blog. I then called in that one category to the blog using the query post link that you posted and it now works! All 6 categories I want in the blog show in the blog without showing the one category that I don’t want shown there and the older posts button works!

    <?php global $wp_query;
    query_posts(
    	array_merge(
    		array('cat' => 72),
    		$wp_query->query
    	)
    ); ?>

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘page/2/ displaying same posts as page 1’ is closed to new replies.