实现这一目标的一种方法是使用gform_pre_render 钩
我曾经在一个真实的网站上做过类似的事情。
add_action( \'gform_pre_render\', \'show_content_before_fields\' );
function show_content_before_fields( $form ) {
$custom_field = new GF_Field_HTML(); // temporary field object to hold our custom html
$custom_field->id = 0; // maybe unnecessary, can\'t remember if really needed
$custom_filed->visibility = \'visible\'; // maybe unnecessary, can\'t remember if really needed
$custom_field->content .= \'<h3>RMA\' . $form[\'id\'] . \'</h3>\'; // The actual custom html content
array_unshift( $form[\'fields\'], $custom_field ); // Adds the custom field before the fields added in the form editor
return $form; // give the form back to Gravity Forms and let it continue it\'s doings
}
此代码只是将任意html代码添加到字段列表的顶部。html不会(不应该)显示在事件条目/电子邮件通知中。
您应该能够将其加入主题的功能中。php或特定于站点的插件。