Last active
December 29, 2015 08:39
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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