在我的主页上,我有两个<section>
在其中,我对不同的帖子类别执行了两个不同的循环。代码如下:
<section>
<ul class="loop-article">
<?php
$pagedArticles = ( get_query_var(\'page\') ? get_query_var(\'page\') : 1 );
$articles = array(\'post_type\' => \'post\', \'post_status\' => \'publish\', \'posts_per_page\' => 3, \'cat\' => 3,\'paged\' => $pagedArticles );
query_posts($articles); $i=0; while (have_posts()) : the_post(); $i++;
?>
<!-- do stuff -->
<?php endwhile; global $wp_query;
$big = 999999999; // need an unlikely integer
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) );
wp_reset_query(); ?>
</ul>
</section>
<section>
<ul class="loop-news">
<?php
$pagedNews = ( get_query_var(\'page\') ? get_query_var(\'page\') : 1 );
$news = array(\'post_type\' => \'post\', \'post_status\' => \'publish\', \'posts_per_page\' => 4, \'cat\' => 4, \'paged\' => $pagedNews );
query_posts($news); $i=0; while (have_posts()) : the_post(); $i++;
?>
<!-- do stuff -->
<?php endwhile; global $wp_query;
$big = 999999999; // need an unlikely integer
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) );
wp_reset_query(); ?>
</ul>
</section>
我面临的问题是,如果我试图看到
\'.loop-article\'
, 分页工作于
\'.loop-news\'
也
我认为这取决于paginator为两个循环创建的相同url:
www.mysite.com/page/2/
但我不确定。。。有可能修复此问题吗?