我已經添加在WordPress的搜索高級搜索..請檢查下面的圖片.. 高級搜索未在Wordpress中顯示正確的結果?
下面是我的搜索代碼在WordPress:
global $wp_query;
$args = array (
's' => $s,
'cat' => $category,
'year' => $year,
'monthnum' => $monthnum
);
$query = new WP_Query($args) ;
<?php if ($query->have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<article>
<h2><?php the_title(); ?></h2>
<div class="entry">
<?php the_content(__('Read More »', 'tie')); ?>
</div>
</article>
<?php endwhile; ?>
<?php endif; ?>
從上面的代碼我得到正確的結果......但是當我改變類別的結果保持不變...?
,如果我得到的搜索結果爲1,2,3,4,5,6,7,8,9和變化對I類需要1,5,6,8,9
什麼是錯的用我的代碼.. ??
檢查args數組'$ category'爲空或不是。 – Noman