Skip to content

Instantly share code, notes, and snippets.

@spivurno
Created February 6, 2019 08:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spivurno/52143c17549bd5f35e01153fea7ec023 to your computer and use it in GitHub Desktop.
Save spivurno/52143c17549bd5f35e01153fea7ec023 to your computer and use it in GitHub Desktop.
<?php
/**
* Gravity Perks // Nested Forms // Re-order Display Fields
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*/
// Update "123" to your form ID.
add_filter( 'gform_pre_render_123', function( $form ) {
foreach( $form['fields'] as &$field ) {
// Update "2" to your Nested Form field ID.
if( $field->id = 2 ) {
// Update "1, 2, 3" to the field IDs from your child form and put them in the desired order.
$field->gpnfFields = array( 1, 2, 3 );
}
}
return $form;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment