Last active
February 22, 2024 08:03
-
-
Save wpmudev-sls/05a8d9ce756c95cde2ce0fa500963539 to your computer and use it in GitHub Desktop.
[Forminator Pro] - Render elementor's tab/accordion shortcode in the HTML field
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 | |
/** | |
* Plugin Name: [Forminator Pro] Render elementor accordion/tab shortcode | |
* Description: Render elementor's accordion/tab shortcode in the HTML field. | |
* Author: Prashant @ WPMUDEV | |
* Task: SLS-5751 | |
* Author URI: https://premium.wpmudev.org | |
* License: GPLv2 or later | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly. | |
} | |
add_filter( 'forminator_replace_variables', 'do_shortcode' ); | |
add_action( 'wp_footer', 'wpmudev_reinit_frontend_elementor', 9999 ); | |
function wpmudev_reinit_frontend_elementor() { | |
global $post; | |
if ( is_a( $post, 'WP_Post' ) && ! has_shortcode( $post->post_content, 'forminator_form' ) ) { | |
return; | |
} | |
?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function($){ | |
$(document).on('after.load.forminator', function(e, form_id) { | |
if ( '9483' == form_id ) { // Please change the form ID. | |
$('#forminator-module-'+form_id).find('select.forminator-select2').each(function () { | |
$(this).on('change', function () { | |
setTimeout(function() { | |
if ( ! window.elementorFrontend ) return; | |
window.elementorFrontend.init(); | |
window.yotuwp.init(); | |
},300); | |
}); | |
}); | |
} | |
}); | |
}); | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment