paged=2 etc just shows the first page results on custom page

  • Unknown's avatar

    Hey all, I have been creating a theme for a friend of mine and have come across a big issue that has had me stumped for several hours already.

    I have created a seperate category-12.php page to show just posts from cat=12 and also show a particular post at the top using the following code.

    [code]<?php
    /**
    * @package WordPress
    * @subpackage Catamount Theme by Will Roberts - imagelimited.co.uk
    */
    ?>
    <?php get_header(); ?>

    <div id="left_bar">
    <?php get_sidebar(); ?>
    <div style="clear:both"></div>
    </div>

    <div id="right_bar">

    <div id="content" class="narrowcolumn">
    <?php query_posts('p=291'); ?>
    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); $do_not_duplicate = $post->ID; ?>

    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    <h2>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></h2>
    <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>

    <div class="entry">
    <?php the_content('Read the rest of this entry »'); ?>
    </div>

    <p class="postmetadata"><?php the_tags('Tags: ', ', ', '
    '); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    </div>
    <?php endwhile; ?>

    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer 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.</p>
    <?php get_search_form(); ?>

    <?php endif; ?>

    <?php query_posts('cat=12&showposts=4'); ?>
    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>

    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    <h2>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></h2>
    <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>

    <div class="entry">
    <?php the_content('Read the rest of this entry »'); ?>
    </div>

    <p class="postmetadata"><?php the_tags('Tags: ', ', ', '
    '); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    </div>
    <?php endwhile; ?>

    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer 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.</p>
    <?php get_search_form(); ?>

    <?php endif; ?>
    </div>
    </div>

    <?php get_footer(); ?>
    [/code]

    For some reason every time i click older entries it simply opens up the same page of results. I just cant get it to display the correct ones.

    Any ideas?

  • Unknown's avatar

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

    This support forum is for WordPress.com hosted blogs only. If you have a self-hosted WordPress blog you need to seek help at the WordPress.org forums, not here.

    If you don’t understand the difference, you may find this information helpful.

  • The topic ‘paged=2 etc just shows the first page results on custom page’ is closed to new replies.