使用 WordPress 插件提供默认模板
我自己编写的 WordPress 插件包含自定义帖子类型。我想为此帖子类型部署默认模板。是否可以在插件目录中执行此操作?我找不到任何关于此的文档。
对我来说,让插件“开箱即用”运行似乎比告诉用户将默认模板复制到其主题目录更好。
My self written Wordpress plugin includes a custom post type. I want to deploy a default template for this post type. Is it possible to do this inside the plugin's directory? I cannot find any documentation on this.
Having the plugin running "out of the box" seems better to me than telling the user to copy the default template to their theme's directory.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
本文介绍了在插件中包含页面模板所需的功能:http://www.unfocus.com/2010/08/10/include-page-templates-from-a-wordpress-plugin/
This article has a walkthrough of the functions you'll need to include page templates in your plugin: http://www.unfocus.com/2010/08/10/including-page-templates-from-a-wordpress-plugin/
它应该在模板目录中定义为 single-xxxx.php
It should be defined on templates directory as single-xxxx.php