Überspringen zu Hauptinhalt

Quickly and dirty add a JQuery script to the WordPress footer

I often search for such a script so now I got this ready made and perfectly at hand if I need it in the future. If you like you can use it too, I jzst need to write some text here so that this post does not look too empty. Thanks.


//TOGGLE CART AFTER ADD TO CART CLICK
add_action( 'wp_footer', 'trigger_for_ajax_add_to_cart' );
function trigger_for_ajax_add_to_cart() {
    /*
	if ( isset($_POST['add-to-cart']) && $_POST['add-to-cart'] > 0
    && isset($_POST['quantity']) && $_POST['quantity'] > 0 ) :
    ?>
    <script type="text/javascript">
        (function($){
            $( ".topbar-cart-link" ).trigger( "click" );
			//    setTimeout(function(){            $( ".open-side-cart" ).trigger( "click" );         }, 500);
            // Display an alert for testing purpose (To be removed)
            alert('".open-side-cart" Click!');

        })(jQuery);
    </script>
    <?php
    endif;
	*/
}

Dieser Beitrag hat 0 Kommentare

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

An den Anfang scrollen