分页不适用于query_posts函数(查询页面)

时间:2017-05-17 13:20:03

标签: php wordpress pagination

我正在尝试查询首页上的所有页面(而不是帖子),每页有20个帖子,分页。

代码:

<?php

$args = array(

    'post_type'  => 'page', 
    'posts_per_page' => 20,
    'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),

);

// The Query

query_posts( $args );    

// The Loop

while ( have_posts() ) : the_post();

?>  

<article id="post-<?php the_ID() ?>" class="post-<?php the_ID() ?> col-md-6 col-sm-12 post type-post status-publish format-standard hentry category-uncategorized">

    <div class="entry-detail">

        <header class="entry-header">

            <center><h2 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> </center>      </header><!-- .entry-header -->
            </div>
</article>

<?php

endwhile;

 ?><div class="navigation">
  <div class="alignleft"><?php previous_posts_link('&laquo; Previous') ?></div>
  <div class="alignright"><?php next_posts_link('More &raquo;') ?></div>
</div>
<?php

// Reset Query

wp_reset_query();

?>

网址为:http://www.theiogames.com/

“更多”链接不起作用。

是否可以添加Wordpress的正常分页样式,如“1,2,3 ... 9,10”?

0 个答案:

没有答案
相关问题