了解 WordPress 永久链接和查询字符串参数

发布于 2025-01-01 13:26:39 字数 583 浏览 2 评论 0原文

我几乎从头开始构建一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑,眼淚并存 2025-01-08 13:26:39

可以通过在主题中提供 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's index.php instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文