Last active
December 22, 2022 11:52
-
-
Save alamgircsebd/98fa6e41b4be15cc59dc518fa4a9027a to your computer and use it in GitHub Desktop.
Add this on your theme functions.php file then use this shortcode [sc_customer_logout]
This file contains 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 | |
// Add this on your theme functions.php file then use this shortcode [sc_customer_logout] | |
add_shortcode( 'sc_customer_logout', 'sc_customer_logout' ); | |
/** | |
* Add a logout shortcode button | |
*/ | |
function sc_customer_logout() { | |
ob_start(); | |
if ( is_user_logged_in()) : | |
?> | |
<sc-button href="<?php echo esc_url( wp_logout_url( get_home_url() ) ); ?>"> | |
<?php esc_html_e( 'Logout', 'surecart' ); ?> | |
</sc-button> | |
<?php | |
endif; | |
return ob_get_clean(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment