Skip to content

Instantly share code, notes, and snippets.

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 wpmudev-sls/05a8d9ce756c95cde2ce0fa500963539 to your computer and use it in GitHub Desktop.
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
<?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