下/上一個環節我有我的WordPress網站靜態頭版,並想獲得分頁工作。不工作WordPress的分頁
如果我手動轉到地址(/ 2 /,/ 3/etc),但是next_posts_link和previous_posts_links完全不起作用,分頁實際上會起作用。
任何人都可以指出我的錯誤在這裏?
<?php $args = array(
'posts_per_page' => 10,
'ignore_sticky_posts'=> 1,
'category__in'=> $cat,
'paged' => $paged,
);
$featured_query = new WP_Query($args);
while ($featured_query->have_posts()) : $featured_query->the_post();
?>
<?php get_template_part('template-parts/content', get_post_format()); ?>
<?php endwhile;?>
<?php wp_reset_postdata(); ?>
<div class="nav-previous alignleft"><?php next_posts_link('Older posts', $featured_query->max_num_pages); ?></div>
<?php if(is_paged()) { ?>
<div class="nav-next alignright"><?php previous_posts_link('Newer posts', $featured_query->max_num_pages); } ?></div>