0
前
目前,我有以下代碼:Woocommerce - 產品展示在搜索結果一切
<?php while (have_posts()) : the_post(); ?>
<?php
if (get_post_type() !== 'post') {
if (get_post_type() == 'landing-pages') {
get_template_part('templates/content/archive', 'landingpages');
} elseif (get_post_type() == 'product') {
get_template_part('templates/content/archive', 'product');
} else {
get_template_part('templates/content/archive', 'cpt');
}
} else {
get_template_part('templates/content/archive', 'posts');
};
?>
<?php endwhile; ?>
<?php get_template_part('templates/modules/nav', 'pagination'); ?>
然而,這只是顯示最新到最舊。隨着自定義帖子,woocommerce產品,帖子,頁面,所有混合togather。
我想只顯示產品,那麼一旦所有匹配的產品已顯示,則返回其他任何相匹配的搜索查詢,例如:其他自定義文章類型,頁面和職位。
就如何實現這一目標有什麼建議?
謝謝。
感謝不幸的是,「推薦」自定義帖子在產品之前會顯示在搜索結果中。我們需要先展示產品,然後再展示其他產品。從我做的快速測試中看起來是正確的。 – Martin 2014-09-22 05:40:36
實際上,這並不意味着工作:在產品(woocommerce自定義帖子類型)中顯示感言(自定義帖子類型) – Martin 2014-09-22 05:47:27