admin管理员组文章数量:1130349
I am new to Wordpress so was wondering if anyone can help?
I am creating a returns form through Gravity Forms. However, at the top of each form, I want to display a returns form number e.g RMA001, RMA002 etc. I'm thinking this could probably be done using some coding but have no idea how to code.
Please could you let me know how to do this and explain where I would need to add the code. Basic straight forward English would be gratefully appreciated!
Thanks soooo much!
Ben
I am new to Wordpress so was wondering if anyone can help?
I am creating a returns form through Gravity Forms. However, at the top of each form, I want to display a returns form number e.g RMA001, RMA002 etc. I'm thinking this could probably be done using some coding but have no idea how to code.
Please could you let me know how to do this and explain where I would need to add the code. Basic straight forward English would be gratefully appreciated!
Thanks soooo much!
Ben
Share Improve this question asked Oct 17, 2018 at 15:31 BenBen 11 bronze badge1 Answer
Reset to default 1One way to achieve that is to use the gform_pre_render hook.
I once did something similiar to this on a real site.
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
}
This code just adds arbitrary html code to the top of the fields list. The html doesn't (shouldn't) show up in the event entries / email notifications.
You should be able to toss this into your theme's functions.php or into a site-specific plugin.
I am new to Wordpress so was wondering if anyone can help?
I am creating a returns form through Gravity Forms. However, at the top of each form, I want to display a returns form number e.g RMA001, RMA002 etc. I'm thinking this could probably be done using some coding but have no idea how to code.
Please could you let me know how to do this and explain where I would need to add the code. Basic straight forward English would be gratefully appreciated!
Thanks soooo much!
Ben
I am new to Wordpress so was wondering if anyone can help?
I am creating a returns form through Gravity Forms. However, at the top of each form, I want to display a returns form number e.g RMA001, RMA002 etc. I'm thinking this could probably be done using some coding but have no idea how to code.
Please could you let me know how to do this and explain where I would need to add the code. Basic straight forward English would be gratefully appreciated!
Thanks soooo much!
Ben
Share Improve this question asked Oct 17, 2018 at 15:31 BenBen 11 bronze badge1 Answer
Reset to default 1One way to achieve that is to use the gform_pre_render hook.
I once did something similiar to this on a real site.
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
}
This code just adds arbitrary html code to the top of the fields list. The html doesn't (shouldn't) show up in the event entries / email notifications.
You should be able to toss this into your theme's functions.php or into a site-specific plugin.
本文标签: Gravity FormsRMA Count
版权声明:本文标题:Gravity Forms - RMA Count 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749253662a2340111.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论