Skip to content

Instantly share code, notes, and snippets.

@wpmudev-sls
Last active April 11, 2024 21:54
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/d9b2e7eec3cf6c91f47e23bd2892bcc1 to your computer and use it in GitHub Desktop.
Save wpmudev-sls/d9b2e7eec3cf6c91f47e23bd2892bcc1 to your computer and use it in GitHub Desktop.
[Hustle Pro] Fix conflict with Shortcodes Ultimate tabs
<?php
/**
* Plugin Name: [Hustle Pro] Fix conflict with Shortcodes Ultimate tabs
* Description: Emulates the tabs' functionality when used within a Hustle Pop-up
* Author: Anderson Salas @ WPMUDEV
* Task: SLS-6013
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
add_action( 'wp_footer', function(){
?>
<script id="hustle-us-tabs-emulation">
( function($){
$( function(){
$( document ).on( 'hustle:module:loaded', function( e, o ){
$( '.hustle-popup .su-tabs-nav span' ).click( function() {
var index = $( this ).index();
var selector = '.hustle-popup.hustle_module_id_' + o.moduleId;
$( selector + ' .su-tabs-nav span').removeClass( 'su-tabs-current' );
$( this ).addClass( 'su-tabs-current' );
$( selector + ' .su-tabs-pane').removeClass( 'su-tabs-pane-open' );
$( selector + ' .su-tabs-panes > div:nth-child(' + ( index + 1 ) + ')').addClass( 'su-tabs-pane-open' );
})
});
});
})( window.jQuery );
</script>
<?php
}, 21 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment