Php 为什么wordpress分页只在第一页工作
我自定义了我的主题,创建了一个名为“movies”的自定义帖子类型,一切正常,但在主页上我想显示所有的电影,但当我使用分页时,在第一页上就可以了,它会创建其他页面链接,但当我单击其他页面链接时,它会创建链接,但它只显示白色页面,该页面上没有显示任何内容,地址也没有问题,我已经在本地主机上测试了该主题,效果良好 这是我的分页代码Php 为什么wordpress分页只在第一页工作,php,wordpress,pagination,Php,Wordpress,Pagination,我自定义了我的主题,创建了一个名为“movies”的自定义帖子类型,一切正常,但在主页上我想显示所有的电影,但当我使用分页时,在第一页上就可以了,它会创建其他页面链接,但当我单击其他页面链接时,它会创建链接,但它只显示白色页面,该页面上没有显示任何内容,地址也没有问题,我已经在本地主机上测试了该主题,效果良好 这是我的分页代码 <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; //$args['pag
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
//$args['paged'] = $paged;
$args= array('post_type' => array('post','movies'),'paged'=>$paged);
$the_query = new WP_Query( $args );
// loop for all posts ( main page )
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post(); ?>
<div class="post-wrapper">
<div class="post-inner-wrapper">
<div class="post-title">
<span class="title">
<?php the_title() ?>
</span>
</div>
<div class="post-content">
<div class="post-outer-text">
<span class="post-inner-text">
<?php echo get_the_content(''); ?>
</span>
</div>
</div>
</div>
<div class="post-image">
<?php the_post_thumbnail(); ?>
</div>
<div class="post-details">
<span class="calendar">
<i class="fa fa-calendar" aria-hidden="true"></i>
<span class="calendar_text">
<?php the_date(); ?>
</span>
</span>
<span class="author">
<i class="fa fa-user" aria-hidden="true"></i><?php the_author(); ?>
</span>
<span class="view">
<i class="fa fa-eye" aria-hidden="true"></i><?php echo get_post_view(get_the_ID()); ?>
</span>
<span class="like">
<i class="fa fa-thumbs-o-up" aria-hidden="true"></i>256
</span>
<span class="more">
<a href="<?php the_permalink()?>">ادامه مطلب</a>
</span>
</div>
</div>
<?php
}?>
<div class="pagination">
<?php global $wp_query;
echo ($wp_query->max_num_pages);
$big = 999999999; // need an unlikely integer
$page = get_query_var('paged');
$page = (!empty($page) ? $page : 1);
// query_posts( 'category_name=category&showposts=2&paged='.$page);
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages
) );?>
</div>
<?php
/* Restore original Post Data */
wp_reset_postdata();
} else {
// no posts found
}
256