我已经搜查几个主题和问题关于这个问题,但我haven't发现适合我的代码的任何答复。
显示我的自定义信息的分页,但是当我点击Show next posts >>
从以前的页面相同的帖子显示,即使网址显示?paged=2
。
我的代码如下:
<div class="podcast-entries">
<?php
$args = array( 'post_type' => 'strn5_podcasts',
'posts_per_page' => 3,
'paged' => (get_query_var('paged') ? get_query_var('paged') : 1 );
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query( $args );
if ( $wp_query->have_posts() ) :
while ( $wp_query->have_posts() ) :
$wp_query->the_post();
?>
<div <?php post_class(); ?> >
<h4 class="podcast-title"><?php the_title(); ?></h4>
<div class="podcast-content">
<?php the_content(); ?>
</div>
<h6><?php the_time('F j, Y'); ?></h6>
<div class="post-separator col-lg-12"></div>
</div>
<?php endwhile; endif; ?>
<div class="navigation-links">
<div class="next-post">
<?php next_posts_link( '>> Siguiente Entrada' ); ?>
</div>
<div class="previous-post">
<?php previous_posts_link( 'Anterior Entrada >>' ); ?>
</div>
</div>
<?php $wp_query = null;
$wp_query = $temp;
wp_reset_query(); ?>
</div> <!-- .podcast-entries -->