我一直在寻找一种解决方案,专门为归档页面显示单独数量的帖子,并认为我已经想出了一些工作代码,但我发现它会弄乱分页。基本上,档案的第2页显示与档案首页相同的帖子。链接:http://hvamgolfklubb.no/category/ukategorisert/
代码:
<?php
/* Sets the amount of posts to display for $querycat */
$querycat = new WP_Query( \'posts_per_page=4\' ); ?>
<?php
/* Start the Loop */
while ( $querycat->have_posts() ) : $querycat->the_post(); /* Display $querycat amount of posts */
/* Include the post format-specific template for the content. If you want to
* this in a child theme then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( \'content\', get_post_format() );
endwhile;
wpbeginner_numeric_posts_nav();
?>
非常感谢您的帮助。我知道这不是数字分页造成的混乱,因为它在实现之前也是这样。我对PHP还是很陌生,但每天都在改进,所以如果您知道任何更好的解决方案,请与我们分享。