Created
December 6, 2021 16:27
-
-
Save patrickposner/2b02b6ecf303dc08687fcb4518a36adf to your computer and use it in GitHub Desktop.
Passster - Logout Button
This file contains hidden or 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 | |
// logout button | |
add_shortcode( 'passster-logout', function() { | |
?> | |
<button id="ps-logout">Logout</button> | |
<script> | |
jQuery(document).ready(function( $ ) { | |
$('#ps-logout').on('click', function() { | |
Cookies.set('passster', '', { | |
expires: 0, | |
path: '/', | |
}); | |
window.location = "https://my-website.com"; | |
}); | |
}); | |
</script> | |
<?php | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment