使用“高级自定义字段”从前端模板创建自定义帖子类型

时间:2014-05-19 17:56:58

标签: php wordpress advanced-custom-fields

我想在前端使用Advanced Custom Fields插件创建自定义帖子类型。

我正在使用教程Create A Front End Form中的代码以及我在Stack Overflow上找到的代码,该代码定义了$options的{​​{1}}。

我到目前为止的代码是:

<?php acf_form(); ?>

我不确定如何使这项工作:

  • 如何指定帖子ID?
  • 我如何/在何处指定与自定义帖子类型和我想要显示的自定义字段的连接?

您能否告诉我在代码中哪些地方可以获得特定信息,例如我的字段ID等?

1 个答案:

答案 0 :(得分:2)

您是否尝试过(将88设置为您的字段组ID)

<?php $options = array(
'post_id' => $id,
'field_groups'  => array(88 ), // this is the ID of the field group
 ....

也许这可以帮助

How to edit a user profile on the front end
Front end post editing using a form
acf-edit-title-content