0
私は検索結果の一部の変数を更新するのに$_GET
を使用していますが、結果の次のページをクリックすると1ページから同じ投稿が表示されます。問題が何であるか把握しているようだ。
<?php
if(isset($_GET['submit'])){
$carigot = $_GET['car'];
$searchm = $_GET['s'];
}
?>
<?php
$custom_query_args = array(
'post_type' => 'post',
'posts_per_page' => '1',
'meta_query' => array(
array(
'key' => 'CurrentLocation',
'value' => $searchm,
'compare' => '=',
),
array(
'key' => 'CarIWant',
'value' => $carigot,
'type' => '',
'compare' => '=',
),
),
'paged' => get_query_var('paged') ? get_query_var('paged') : 1,
);
$custom_query = new WP_Query($custom_query_args);
$temp_query = $wp_query;
$wp_query = NULL;
$wp_query = $custom_query;
if ($custom_query->have_posts()) :
while ($custom_query->have_posts()) :
$custom_query->the_post();
get_template_part('template-parts/post/content', 'excerpt');
endwhile;
endif;
// Reset postdata
wp_reset_postdata();
next_posts_link('Next', $custom_query->max_num_pages);
previous_posts_link('Previous');
$wp_query = NULL;
$wp_query = $temp_query;
?>
ご回答ありがとうございます。あなたのように私のコードを変更しましたが、問題はまだそこにあります。上記の投稿を編集して、私が今使っているコードを見せてください。あなたが正しく言ったことはすべてやったのですか? – Oscar