隐藏新帖子中的自定义字段? [英] Hide Custom Fields in New Post?

查看:93
本文介绍了隐藏新帖子中的自定义字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用WordPress,但是自定义字段存在一些问题。这是来自functions.php的代码

I just started out with WordPress and I'm having some problems with the custom fields. Here's the code from functions.php

add_post_meta($post_id, 'Post Thumbnail', $post_thumb, true) or update_post_meta($post_id, 'Post Thumbnail', $post_thumb);
add_post_meta($post_id, 'Project URL', $url, true) or update_post_meta($post_id, 'Project URL', $url);
add_post_meta($post_id, 'Project Thumbnail', $thumb, true) or update_post_meta($post_id, 'Project Thumbnail', $thumb);

问题是当我尝试创建新帖子时,它们会显示出来:

The problem is that they show up when I try to create a new post like so:

替代文字http://dl.getdropbox.com/u/118004/Screen%20shot%202010-05-12%20at%2010.45.35%20AM.png

另一个问题是,它们只有在我发布帖子,返回并阅读每个字段的情况下才起作用。有什么方法可以隐藏字段以仅显示添加新的自定义字段:部分?谢谢!

The other problem is that they don't even work, only if I publish the post, go back and readd each field. Is there any way to hide the fields to only show the "Add new custom field:" part? Thank you!

推荐答案

如果最终用户不需要对其进行编辑,则可以隐藏自定义字段,并开始使用下划线将其命名( '_')。请参阅: http://codex.wordpress.org/Function_Reference/add_post_meta#Making_a_。 22Hidden.22_Custom_Field

If end users don't need to edit them you can hide custom fields starting naming them with an underscore ('_'). see: http://codex.wordpress.org/Function_Reference/add_post_meta#Making_a_.22Hidden.22_Custom_Field

btw,我认为最好避免在自定义字段键中插入空格。

btw, I think it's better to avoid inserting spaces within custom fields keys.

这篇关于隐藏新帖子中的自定义字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆