【问题标题】:Wordpress Kriesi Pagination IssueWordPress Kriesi 分页问题
【发布时间】:2013-05-04 00:24:10
【问题描述】:

我无法在我的网站上找出这个分页问题。问题是第 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(); ?>

This is the site for Kriesi pagination.

Site.

【问题讨论】:

  • 尝试不同的插件。我用PageNavi,效果很好。

标签: php wordpress wordpress-theming


【解决方案1】:

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

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

【讨论】:

  • 感谢一百万!这似乎已经成功了!你今天教会了我一些新东西,哈哈。
猜你喜欢
  • 1970-01-01
  • 2015-05-15
  • 2014-09-06
  • 2013-04-23
  • 2021-07-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多