Wordpress分页链接显示与主页相同的帖子为什么?

时间:2016-05-07 18:32:59

标签: wordpress pagination

我使用下面的代码并提供分页链接,遗憾的是每个分页页面都有相同的内容和主页原因?

<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array( 'posts_per_page' => 3 ,'paged'=>$paged);
$the_query = new WP_Query( $args ); 
while ($the_query ->have_posts()) : $the_query -> the_post();
 ?>
<div id="pbox">

    <div id="pthumb"><a href="<?php the_permalink(); ?>" class="ptitle"><?php the_post_thumbnail('thumbnail', array('class' => 'mythumbnail')); ?></a></div>
        <div id="pcontent">
    <a href="<?php the_permalink(); ?>" class="ptitle"><?php the_title(); ?></a>
    <?php the_excerpt(); ?><br />

Post Category: <b><?php the_category( ', ' ); ?></b>



        </div>
    </div>
<?php
endwhile;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    'format' => '/page/%#%',
    'current' => max( 1, get_query_var('paged') ),
    'total' => $the_query->max_num_pages
) );
echo $paged;
wp_reset_query(); ?>

0 个答案:

没有答案
相关问题