• Resolved sebbri

    (@sebbri)


    Hi guys,

    I have a really annoying problem with a WP-installation of mine. I have developed the theme myself, like I have done with numerous themes before. However, in this theme, I’m not able to display older posts than the ones on the frontpage.

    It doesn’t matter if I use the template-tags for next_posts, nothing happens.

    What am I doing wrong?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Does your template file use a custom query?

    Thread Starter sebbri

    (@sebbri)

    This is the code for the index.php

    <?php get_header() ?>
    <div class="wrapper">
    <div class="textarea">
    <?php query_posts($y_string.'&cat=-1184'); ?>
    <?php while( have_posts() ) : the_post() ?>
    <h1 class="<?php post_class() ?>"><a>" title="Klicka h?r f?r att l?sa inl?gget"><?php the_title ()?></a></h1>
    <div class="post-meta">Skrivet av <?php the_author() ?>, <?php the_date('d M') ?> <?php the_time() ?> i kategorin <?php the_category(); ?></div>
    <div class="post">
    <?php the_content('L?s vidare'); ?>
    </div>
    <?php endwhile; ?>
    <?php rewind_posts(); ?>
    <div class="navigation"><p><?php posts_nav_link(); ?></p></div>
    </div>
    <div class="side">
    <?php get_sidebar('left'); ?>
    <?php get_sidebar('right'); ?>
    <?php get_sidebar('google'); ?>
    <?php get_sidebar('box'); ?>
    </div>
    </div>
    </div>
    <?php get_footer() ?>

    Try changing <?php query_posts($y_string.'&cat=-1184'); ?>
    to:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($y_string.'&cat=-1184&paged=' . $paged); ?>

    Thread Starter sebbri

    (@sebbri)

    Thanks esmi, works like a charm!

    How come my query didn’t work?

    When you use query_posts, you completely over-write the standard post query and it’s pagination component. I simply added that pagination back into your custom query. The line translates to: if the WP_Query object contains a paged variable (only set for pages > 1), set the $paged variable to that value. Otherwise set $paged to 1 as we must be on the first page.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Not displaying older posts’ is closed to new replies.