如何将自定义字段添加到 WordPress 3 中的自定义帖子类型?
我使用 register_post_type 函数创建了一个自定义帖子类型,现在我想向其中添加自定义字段。这些必须尽可能用户友好并集成在 GUI 中。
我尝试了自定义字段模板,但最终用户不太喜欢它。我更喜欢添加新字段和带有代码的新元框。
I created a custom post type with the register_post_type function, and now I want to add custom fields to it. These must be as user friendly and integraded in the GUI as possible.
I tried the custom field template but I dont really like it for end users. I prefer to add the new field and a new meta box with code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现这一系列教程非常有帮助:
如果您想要一个直接的代码示例,这段代码基本上是我自己使用的模板:(使用 Scribu 的最佳脚本加载技术)
I found this series of tutorials were very helpful:
And if you want a straight up code sample, this code is basically the template that I use for myself: (Using Scribu's optimal script loading technique)
我写了一篇关于如何在 WordPress 管理区域中按自定义字段对自定义帖子类型进行排序的教程。我发现大多数时候按发布日期订购自定义帖子类型并不是很有用。
可以在这里找到它: http://www.eggplantstudios.ca/blog/wordpress-order-custom-post-type-by-custom-field-in-the-admin-area
I've written a tutorial on how to sort your custom post types by custom fields in the Wordpress admin area. I find that most times ordering a custom post type by the date posted isn't really useful.
Can find it here: http://www.eggplantstudios.ca/blog/wordpress-order-custom-post-type-by-custom-field-in-the-admin-area