在我的Wordpress中,阅读设置中,博客页面最多显示7条帖子。我在顶部有一个帖子,下面是波纹管-连续3个。当点击按钮加载更多时,我使用此插件https://wordpress.org/plugins/infinite-scroll-and-load-more-ajax-pagination/来显示更多帖子。问题是,当我单击此按钮时,还显示7条帖子,我需要6条帖子-连续3条。
<?php
$queryPosts = get_query_posts();
if ( $queryPosts->have_posts() ) {
$postCounter = 0;
$postBoxCounter = 0;
while ( $queryPosts->have_posts() ) : $queryPosts->the_post();
if ( $postCounter == 0 && get_current_page_number() == 1) {
get_template_part( 'content', 'category-first-item' );
} else {
if ( $postBoxCounter % 3 == 0 ) {
echo '</div>';
echo '<div class="row post-container">';
}
get_template_part( 'content', 'category' );
$postBoxCounter ++;
}
$postCounter ++;
endwhile;
} else {
get_template_part( 'content', 'none' );
}
wp_reset_postdata();
?>