我又遇到了这些“wtf”问题之一。我不明白为什么我的搜索表单没有显示结果。请参阅此网页:http ://sindlar.cz/exemlum/?lang=en
标题中有 get_search_form() 。我还创建了 searchform.php 和 search.php。查看 search.php:
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'shape' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
</header><!-- .page-header -->
<?php shape_content_nav(); ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'search' ); ?>
<?php endwhile; ?>
<?php shape_content_nav( 'nav-below' ); ?>
<?php else : ?>
<?php get_template_part( 'no-results', 'search' ); ?>
<?php endif; ?>
</div><!-- #content .site-content -->
</section><!-- #primary .content-area -->
单击搜索按钮后打开搜索页面,但没有结果。也许数据库有什么问题吗?你有什么想法?我应该在function.php中添加一些东西吗?
我还注意到搜索网站的实际内容和虚构的词之间存在差异。例如,如果您键入“关于我们”(这是我网站中的实际页面),它将显示 search.php 但没有结果。另一方面,如果您键入“Big truck”或“fsdgwdhs”(我编造的),它会发回除 search.php 之外的其他页面。所以我认为 wordpress 可能知道有一些结果,但它没有显示出来。我不知道。
有人可以帮我吗?
谢谢!