php - bbpress 的正确搜索表达式
我的 WordPress 安装中有一个非常 purdy 风格的搜索框,为了寻找连续性,我希望我的 bbpress 论坛也有同样的搜索框 - 目前我失败了。
对于 WP 我有:
<div id="search">
<form action="<?php bloginfo('home') ?>" method="get">
<div class="hiddenFields"></div>
<p><input name="s" id="s" maxlength="100" size="18" /><input class="submit" id="submit-button" type="submit" value="submit" /></p></form>
</div>
对于 bbPress 形式 'method="get">'被踢出去了,当然我需要另一种表达方式。 bbpress 通常似乎使用:
<div class="search"><?php search_form(); ?></div>
这会破坏一切 - 除了位置之外,我根本没有任何样式属性...... 我可以通过删除 - 但它显然只是一个没有搜索的虚拟 - 有任何想法来修复后者吗? 谢谢
<div id="search">
<div class="hiddenFields"></div>
<p><input name="s" id="s" maxlength="100" size="18" /><input class="submit" id="submit-button" type="submit" value="submit" /></p>
</div>
I have a very purdy styled search box in my wordpress install, and looking for continuity I want the same for my bbpress forum - currently I'm failing.
For WP I have:
<div id="search">
<form action="<?php bloginfo('home') ?>" method="get">
<div class="hiddenFields"></div>
<p><input name="s" id="s" maxlength="100" size="18" /><input class="submit" id="submit-button" type="submit" value="submit" /></p></form>
</div>
For bbPress The form 'method="get">' gets kicked out and of-course I need another expression. bbpress generally seems to use:
<div class="search"><?php search_form(); ?></div>
This wrecks everything - I get no styling attributes at all other than position...
I can make it look fine (and consistent) with by removing the - but then it's obviously just a dummy with no search - any ideas to fix the latter?
Thanks
<div id="search">
<div class="hiddenFields"></div>
<p><input name="s" id="s" maxlength="100" size="18" /><input class="submit" id="submit-button" type="submit" value="submit" /></p>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它使用主题文件中的 search-form.php 文件来显示搜索表单。您可以在那里设置它的样式,如果您的主题文件中不存在该文件,它将使用默认主题中的文件。
It uses the search-form.php file in your theme file to display the search form. You can style it there and if the file doesn't exist in your theme file, it uses the one from default theme.
@billn,这是一个拼写错误吗?
正如 @AshFame 所说,在主题文件夹中创建一个名为
searchform.php
的文件,search_form()
将加载该文件而不是默认值。@billn, was that a typo?
As @AshFame said, create a file named
searchform.php
in your theme folder, andsearch_form()
will load that instead of the default.