创建一个可以直接调用的自定义 WordPress 插件,例如 mydomain.com/mytemplate.php?id=xx
我需要创建一个模板,现在已经完成,但我想直接调用它,而不必创建任何使用我的文件作为模板的页面。 这个想法是有一个特定的模板来显示一些自定义信息,并像这样调用它: http://mydomain。 com/mycustomtemplate.php?id=7777
我尝试按原样调用它,但不起作用...说找不到文件或目录
有人有建议或经历过这个吗?
谢谢我提前!
I need to create a template, which is done by now, but i want to call it directly without have to create any page that use my file as the template.
The idea was having a specific template to show some custom information and call it like: http://mydomain.com/mycustomtemplate.php?id=7777
I try to call it like it is and doesn't work... says file or directoy not found
Anyone has a sugestion or been through this?
Thanks i advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你需要对此进行更详细的阐述。是否有只为某些页面提供自定义模板的想法?
WordPress 主题(或您引用的模板)无法按照您所指的方式工作:
http://mydomain.com/mycustomtemplate.php?id=7777
上面的链接引用了整个 WordPress 主题层次结构之外的文件。
请更清楚地说明您想要实现的目标。
I think you need to elaborate a little more on this. Is the idea to have a custom template for only certain pages?
Wordpress themes (or templates as you are reffing to them as) don't work in the manner that you are referring to:
http://mydomain.com/mycustomtemplate.php?id=7777
The link above refers to a file outside of the whole Wordpress Theme hierarchy.
Please be more clear on what you are trying to accomplish.
您想要一个模板,但没有实际使用它的文件?您需要对 WordPress 的标准 RewriteRules 进行一些修改,以检测应使用您的模板的 URL,并将请求重定向到可识别该模板的位置。
你基本上是在说“我想拥有一辆车,但我实际上不想拥有一辆车,我怎样才能拥有一辆车?”
You want to have a template, but no file that actually uses it? You'd need some hack up Wordpress's standard RewriteRules to detect a URL that should use your template and redirect the request somewhere that is aware of the template.
You're basically saying "I want to have a car, but I don't want to actually HAVE a car, how can I have a car?"