如何使用WordPress在search.php页面中显示搜索结果?

时间:2018-02-24 05:32:45

标签: wordpress

我正在开发一个基本的自定义WordPress模板。在这里,我有一个像这样的搜索表单:

<form class="navbar-form"  role="search" method="get" id="searchform" action="">
<div class="input-group">
    <input type="text" class="form-control search" placeholder="Search" name="q">
    <div class="input-group-btn">
        <button class="btn btn-default search" type="submit"><i class="glyphicon glyphicon-search"></i></button>
    </div>
</div>
</form> 

现在,当我搜索某些内容时,它将转到home.php页面(网站主页),但我需要调用search.php文件,以便所有搜索结果都显示在search.php文件中。

我目前使用的文件列表:

  1. 404.php 2. footer.php 3. header.php 4. home.page 5. index.php(empty)
  2. page.php 7.search.php 8.single.php 9.style.css 10.screenshot.png
  3. 如何在search.php页面中显示结果?

    注意:新的WordPress。

1 个答案:

答案 0 :(得分:0)

我找到了解决方案。我需要将[Row(c1=1, c2=2, c3=21), Row(c1=2, c2=6, c3=32), Row(c1=3, c2=1, c3=12), Row(c1=4, c2=2, c3=65), Row(c1=5, c2=4, c3=43), Row(c1=6, c2=6, c3=52)] 替换为name="q"

感谢。

相关问题