我正在尝试在使用WordPress构建的Intranet主页上创建表单。我正在尝试使用高级自定义字段(ACF)创建表单。我已按照ACF文档中提供的说明进行操作:http://www.advancedcustomfields.com/resources/using-acf_form-to-create-a-new-post/。
我已经阅读了几个答案,其中人们使用了一个名为ACF前端显示插件的插件,其中包含以下网址:https://wordpress.org/plugins/acf-frontend-display。此插件似乎不再存在。我需要为ACF Pro弹簧吗?
我试图在front-page.php
中执行此操作。我在get_header();
上面添加了这一行。
acf_form_head();
我在表格中添加了以下内容:
acf_form(array(
'post_id' => 'new_post',
'new_post' => array(
'post_type' => 'post',
'post_status' => 'publish'
)
));
感谢您的帮助。
答案 0 :(得分:1)
问题在于我使用的是高级自定义字段的免费版本(在编写本文时)是4.4.2
。 ACF的所有在线文档都默认使用版本5文档。 ACF Pro是版本5.2.9
。
版本4不支持创建新帖子。必须使用专业版才能使用此功能创建新帖子。
答案 1 :(得分:0)
从示例中可以看出,至少你需要它(你缺少标题和内容):
acf_form(array(
'post_id' => 'new_post',
'post_title' => true,
'post_content' => true,
'new_post' => array(
'post_type' => 'post',
'post_status' => 'publish'
)
));
但是这也应该包含在循环中(即<?php while ( have_posts() ) : the_post(); ?>
)。