【发布时间】:2013-12-12 01:11:20
【问题描述】:
这就是我在functions.php中定义的战争
function create_post_type(){
register_post_type('my_persons',
array('labels' =>
array(
'name' => __('Persons'),
'singular_name' => __('Person')
),
'public' => true,
'menu_position' => 5,
'rewrite' => array('slug' => 'persons'),
'supports' => array('title', 'editor','thumbnail')
)
);
register_post_type('my_shoes',
array('labels' =>
array(
'name' => __('Shoes'),
'singular_name' => __('Shoe')
),
'public' => true,
'menu_position' => 6,
'rewrite' => array('slug' => 'shoes'),
'supports' => array('title', 'editor')
)
);
}
add_action('init', 'create_post_type');
我想要做的是,当添加一个新人时,我想查看(已添加)鞋子的列表并选择(通过复选框)他拥有的鞋子。
我已经安装了“高级自定义字段”插件。我知道可以在其中定义鞋子的复选框列表并将其用作人员的字段。但我希望在添加新的“鞋子”自定义帖子时动态填充此字段。
这很难解释,但我想你明白了。顺便说一句,我正在使用 Wordpress 3.7.1,对此我完全陌生。
任何帮助表示赞赏;-)
【问题讨论】:
-
我认为这个插件已经有一个custom_post_types的下拉列表..
-
如果有,我找不到了。
-
我将复选框与下拉菜单混淆了。它有一个名为 post_object 的选项来生成 Dropdown (我认为不是复选框..),但请查看我的答案。您可以轻松过滤复选框。
标签: wordpress field custom-post-type dynamically-generated