了解 WordPress 永久链接和查询字符串参数
我几乎从头开始构建一个 WordPress 主题,但我遇到了这个坎坷。
我有这个网址: http://localhost/mysite.com/wordpress/portfolio/
显示我定义的模板类型“portfolio”的页面。
我试图在该页面上添加搜索框/结果,我的问题是这个网址:
http://localhost/mysite.com/wordpress/portfolio/?s=test&submit=Search
不显示我的作品集页面/模板,而是显示我的主页。
如果有人可以向我解释发生了什么事,我将非常感激。请详细了解技术细节,我正在我的 WAMP 上运行 worpress 的本地副本,并打算在我的产品上发布所有这些内容。服务器最终。
谢谢!
I'm building a wordpress theme from almost scratch and I come to this bump in the road.
I have this URL: http://localhost/mysite.com/wordpress/portfolio/
That shows a page of the template type "portfolio" that I have defined.
I'm trying to add a search box / results on that page and my problem is that this url:
http://localhost/mysite.com/wordpress/portfolio/?s=test&submit=Search
Does not show my portfolio page / template, but rather my home page.
If someone can explain to me what's going on, I'd appreciate it very much. Please go in technical details, I'm running a local copy of worpress on my WAMP and intend on releasing all this on my prod. server eventually.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以通过在主题中提供
search.php
来自定义搜索结果页面的格式。如果此文件不存在,则 WordPress 将使用主题的index.php
代替。The format of the search results page can be customised by providing a
search.php
within your theme. If this file is not present, then WordPress will use the theme'sindex.php
instead.