Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress Kriesi分页问题_Php_Wordpress_Wordpress Theming - Fatal编程技术网

Php Wordpress Kriesi分页问题

Php Wordpress Kriesi分页问题,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我在我的网站上很难找到这个分页问题。问题是第2页显示的内容与第1页相同。它不应该这样做 <?php $args = array( 'post_type' => 'baseball-news', 'posts_per_page' => 5 ); $baseball_loop = new WP_Query( $args ); while ( $baseball_loop->have

我在我的网站上很难找到这个分页问题。问题是第2页显示的内容与第1页相同。它不应该这样做

<?php
                $args = array( 'post_type' => 'baseball-news', 'posts_per_page' => 5 );
                $baseball_loop = new WP_Query( $args );
                while ( $baseball_loop->have_posts() ) : $baseball_loop->the_post();
                ?>

                    <?php   
                    if ( get_post_type() == 'baseball-news' ) : ?>

                        <?php include( TEMPLATEPATH . '/includes/show-baseball-posts.php' ); ?>

                    <?php endif; ?>

                <?php endwhile; ?>
                <?php kriesi_pagination($baseball_loop->max_num_pages); ?>
                <?php wp_reset_query(); ?>


.

您没有在查询中使用分页参数paged。您可以这样使用它:

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
$args = array( 'post_type' => 'baseball-news', 'posts_per_page' => 5 ,  'paged' => $paged );

$args=array('post\u type'=>'棒球新闻','posts\u per\u page'=>5,'paged'=>$paged);

尝试其他插件。我用,效果很好。万分感谢!这似乎成功了!你今天教了我一些新东西,哈哈。