Skip to content

Instantly share code, notes, and snippets.

@jameslaws
Last active December 29, 2015 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameslaws/7645052 to your computer and use it in GitHub Desktop.
Save jameslaws/7645052 to your computer and use it in GitHub Desktop.
Create an anchor on forms so when a form is submitted without AJAX it return to the form.
<?php
function nfjal_add_anchor_to_form() {
echo '<div name="ninja-form-top"></div>';
}
add_action( 'ninja_forms_display_before_form_wrap', 'nfjal_add_anchor_to_form' );
function nfjal_add_anchor_to_url() {
global $ninja_forms_processing;
$url = 'http://YOUR_URL/#ninja-forms-top';
$ninja_forms_processing->update_form_setting( 'landing_page', $url );
}
add_action( 'ninja_forms_pre_process', 'nfjal_add_anchor_to_url' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment