WordPress 自定义帖子
我在 WordPress 中的自定义帖子类型方面遇到了严重问题。我制作了一个名为“布道”的帖子类型。然后,我添加一个带有一些文本字段的元框,并将结果回显到网页上。但这是我的问题。第一次添加“讲道”时,它工作正常并且元框字段输出正确。但是,当我尝试编辑其中一个元框而不编辑其他元框时(例如,在关闭网络浏览器后,我记得我需要向字段添加一些内容),未编辑的字段将变为空白,并且其中的内容被删除了......一点都不好。
因此,为了简化这一点:第一次填充元框时,它们工作得很好。但是,当第二次编辑帖子时,未填写但保留原样的字段在保存帖子时变为空白。
帮助...我不是一个太多的开发人员,所以我不太确定如何解决这个问题...(让元字段正常工作已经足够困难了。)
(如果您想要使用实际的代码,请告诉我,我会在某个地方添加。
I'm having a serious problem with custom post types in Wordpress. I made a post type called "Sermons". I then add a meta box with some text fields and echo out the results onto the web page. But here's my problem. The first time when you add a "Sermon", it works fine and the meta box fields output correctly. However, when I try to edit one of the meta boxes and do not edit the others, (say after I closed the web browser I remembered that I needed to add something to the fields,) the fields that were not edited become blank and the content in them is erased...not good at all.
So, just to simplify this: the first time the meta boxes are filled they work fine. However, when editing the post for the second time, the fields that are not filled out, but left as they were, become blank upon saving the post.
Help...I'm not too much of a developer so I'm not exactly sure how to fix this...(it was hard enough getting the meta fields to work.)
(If you want the actual code used, please tell me and I will add is somewhere.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有一个关于添加 WordPress 元框 另外查看我的WPalchemy Meta Box PHP Class,它将帮助您轻松创建元框。
I've got a good tutorial on adding WordPress Meta Boxes additionally check out my WPalchemy Meta Box PHP Class which will help you create meta boxes with ease.
问题已解决: http://net.tutsplus.com/tutorials/wordpress/rock-solid-wordpress-3-0-themes-using-custom-post-types/#div-comment-302050
Problem solved: http://net.tutsplus.com/tutorials/wordpress/rock-solid-wordpress-3-0-themes-using-custom-post-types/#div-comment-302050