dongmao7195 2012-05-07 03:02
浏览 29
已采纳

Wordpress query_posts()没有显示旧帖子

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(); ?>
  • 写回答

1条回答 默认 最新

  • duan1226 2012-05-07 05:03
    关注

    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?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名