@replace {{_formID}}
<?php // Prepends or appends fields (marked by class `prepend-to-pages` or `append-to-pages` respectively) to every page of a Gravity Form
add_action( 'gform_pre_render{{_formID}}', function( $form ) {
add_action( 'wp_footer', function () { ?>
<script type="text/javascript">
jQuery(document).bind('gform_post_render', function(event, form_id, current_page) {
jQuery(jQuery('.gfield.prepend-to-pages').get().reverse()).each(function() {
jQuery(this).prependTo(`#gform_page_${form_id}_${current_page} .gform_fields`);
});
jQuery(jQuery('.gfield.append-to-pages').get().reverse()).each(function() {
jQuery(this).appendTo(`#gform_page_${form_id}_${current_page} .gform_fields`);
});
} );
</script>
<?php } );
return $form;
} );