在 WordPress 中不显示多词搜索的搜索结果
我自定义了一个主题,但在使用多字查询的搜索结果方面遇到了一些问题.网站位于 www.abetterworldbydesign.com
I've customized a theme and am having some problems with search results using multiple-word queries. Site is live at www.abetterworldbydesign.com
搜索单个词按预期工作.
搜索多个应该返回结果的词却显示空白结果.>
下面的 searchform.php 代码.
Searching for multiple words that should have returned results shows blank results.
Code for searchform.php below.
</表单>
<form id="searchform" name="searchform" method="get" action="<?php echo home_url(); ?>">
<div>
<input type="text" id="s" name="s" />
<input type="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'richwp' ); ?>" />
</div>
</form>
我在 search.php 中用于初始化 WP_Query 的代码完全遵循代码中列出的代码.pastebin 上的search.php 的完整代码.
My code in search.php for initializing WP_Query follows exactly the code listed in the codex. Full code for search.php on pastebin.
我猜你需要解码你从查询字符串中提取的搜索词,像这样:$search_query[$query_split[0]]= urldecode($query_split[1])
.虽然,您可能只使用 Wordpress 的 get_query_var
函数而不是所有这些代码.
I would guess you need to decode the search term you are extracting from the query string, like so: $search_query[$query_split[0]] = urldecode($query_split[1])
. Although, you could probably just use Wordpress's get_query_var
function instead of all that code.