现在正在努力让分页工作。我显示10个帖子/页面,但当我点击下一页时,我不断被带到一个空白页面。
有任何想法/建议吗?
global $wp_query;
$paged = (empty($wp_query->query_vars["paged"])) ? 1 : $wp_query->query_vars["paged"]; //used for paging, eg 10 results on first page, 10 on second
$args = array(
'post_type' => 'jobs',
's' => $_POST['keyword'],
'tax_query' => array(
'relation' => $relation,
array(
'taxonomy' => 'job-type',
'field' => 'id',
'terms' => $job_type,
),
array(
'taxonomy' => 'location',
'field' => 'id',
'terms' => $location,
)
),
'posts_per_page' => 10,
'paged' => $paged
);
$wp_query = new WP_Query($args);
if ($wp_query->have_posts()) :
while ($wp_query->have_posts()) :
$wp_query->the_post();
。
<?php endwhile;
<div class="nav-previous"><?php next_posts_link('Next Page >>'); ?></div>
<div class="nav-previous"><?php previous_posts_link('<< Previous Page'); ?>