Support » Fixing WordPress » problem getting pagination to work

  • hi, I have and a page set up to dispaly a maximum of 5 post (set in the wordpress admin section)and only belonging to a certain category.
    There could be losts of these posts so id like to paginate between pages of posts belonging to this category, however clicking newer or older links the page just stay on the same initial set of 5 posts
    <div id=”newsListHolder”>
    <div id=”newsListBottom” class=”clearfix”>
    <ul id=”newsGallery” class=”clearfix”>
    query_posts(“cat=4&orderby=modified”); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

  • <?php the_content(); ?>
  • <?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>


    <?php else : ?>
    <p>Sorry, but you are looking for something that isn’t here.</p>
    <?php endif; ?>
    Many thanks in advance

Viewing 5 replies - 1 through 5 (of 5 total)
  • Add this above your query_post:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>

    And this in your query:


    thanks, tried that and nothing happened, the posts stayed the same, only the “newer” & “older” links changed as appropriate

    I did mange to get it working using the following
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();

    in place of

    <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 0; ?>
    query_posts(“cat=4&orderby=modified&&paged=$page&&&showposts=3”); ?>`

    Sorry, try: query_posts("cat=4&orderby=modified&paged=$paged");

    thanks, that did it too

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘problem getting pagination to work’ is closed to new replies.