我有3到4类在我的网站上。我正在使用WordPress搜索,但是当我搜索我的类别时,我就得到了
什么也没找到
此外,我试图搜索子类别,然后,我也得到了同样的信息。
你能帮我解决这个问题吗?
search.php
<section id="primary" class="content-area mainSearch">
<main id="main" class="site-main">
<div class="equalPadding">
<div class="cp-seeWrapper">
<?php if ( have_posts() ) :
get_search_form();//search form
?>
<div class="resultCount"><?php
global $wp_query;
echo $wp_query->found_posts.' RESULTS';
?></div>
<div class="row">
<?php
while (have_posts()){the_post();?>
//displaying result here
<?php } ?>
<?php
else :
get_template_part( 'template-parts/content', 'none' );
endif;
?>
</div>
</div>
</div>
</main><!-- #main -->
</section><!-- #primary -->发布于 2019-11-20 12:38:24
默认情况下,WordPress不包括搜索结果的类别名称。你应该自己去做。前面讨论过here。
发布于 2019-11-20 13:48:31
不能搜索类别,只能搜索类别的内容.
https://stackoverflow.com/questions/58952304
复制相似问题