[Hustle] Hustle slide-in

With the Hustle slide-in, is there any way to have it stop activating if the "call to action" button has already been pressed? thanks

  • Ash

    Hello Ted Kavadas

    Please try the following code:

    add_action( 'wp_head', function() {
    	?>
    	<script type="text/javascript">
    		jQuery(function($){
    			$('a.hustle-modal-cta').click(function(e){
    				e.preventDefault();
    				$(this).closest('.hustle-modal-body').find('.hustle-modal-close svg').click();
    				window.location.href = $(this).attr( 'href' );
    			});
    		});
    	</script>
    	<?php
    } );

    You can use this code in your child theme's functions.php if the theme is not changed. Otherwise mu-plugin is the best option. To create a mu-plugin, go to wp-content/mu-plugins folder. If there is no mu-plugins folder then, create one. Now, inside the mu-plugins folder create file with name anything.php (make sure file extension is .php). Now start with a <?php tag and then put the above code.

    If you use to open the CTA link in a new tab, then remove the following two lines from my code:

    e.preventDefault();
    window.location.href = $(this).attr( 'href' );

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!

    Cheers,
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.