Created
October 27, 2021 14:57
-
-
Save adczk/cb9c4dafa9a2162a7258fd0ffb10cdee to your computer and use it in GitHub Desktop.
Forminator 1.15.3 - scroll to poll results from link
This file contains hidden or 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 | |
/** | |
* Plugin Name: [Forminator] - scroll to poll results via link | |
* Description: scrolls page to poll results if results are displayed via "view results" link | |
* Author: Adam @ WPMUDEV | |
* Author URI: https://wpmudev.com | |
* License: GPLv2 or later | |
* | |
* Tested with Forminator 1.15.3 and 1.15.4 (backwards/future compatibility unknown) | |
*/ | |
#append "#result" anchor to "view results" link | |
add_filter( 'forminator_render_button_markup','wpmu_forminator_poll_result_link_id', 10, 1); | |
add_filter( 'formiantor_render_button_disabled_markup','wpmu_forminator_poll_result_link_id', 10, 1); | |
function wpmu_forminator_poll_result_link_id( $html ) { | |
$html = str_replace( '" class', '#result" class', $html ); | |
return $html; | |
} | |
#add "result" ID to poll header | |
add_filter( 'forminator_poll_header', 'wpmu_forminator_poll_header_id', 10, 1); | |
function wpmu_forminator_poll_header_id( $html ) { | |
$html = str_replace( 'class="forminator-poll', 'id="result" class="forminator-poll', $html ); | |
return $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment