简体   繁体   中英

Wordpress query_posts() not showing old post

This is my sample site, http://box7.host1free.com/~avodes/ and I am having trouble on the blog post (blog.php). Even I if clicked the "old entries" link still the 5 new post are still showing instead of the old post.

Here's my code:

blog.php

    <?php

/*
Template Name: Blog-2
*/

?>

<?php get_header(); ?>
        <?php query_posts( array(
     'posts_per_page' => 5,
     'cat' => '1',
     'paged' => ( get_query_var('page') ? get_query_var('page') : 1 ),
));
?>

<div id="main-content">

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

        <div <?php post_class() ?> id="post-<?php the_ID(); ?>">



            <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>

            <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>

            <div class="entry">
                <?php the_content(); ?>
            </div>

            <div class="postmetadata">
                <?php the_tags('Tags: ', ', ', '<br />'); ?>
                Posted in <?php the_category(', ') ?> | 
                <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?>
            </div>

        </div>

    <?php endwhile; ?>

    <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>

    <?php else : ?>

        <h2>Not Found</h2>

    <?php endif; ?>

    </div>

<?php get_footer(); ?>

I don't have a WordPress installation handy to check, but this page seems to imply you should be using "page", not "paged" in your get_query_var .

Does that make a difference?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM