Created
March 27, 2013 19:31
-
-
Save erickarbe/5257290 to your computer and use it in GitHub Desktop.
WordPress Logout Shortcode
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
//Logout Shortcode | |
function logout_func ($atts, $content = null) { | |
extract(shortcode_atts(array( | |
'linktext' => 'Log Out', | |
), $atts)); | |
$logoutlink = wp_logout_url( home_url() ); | |
return '<a href="' . $logoutlink . '" title="Logout">'. $linktext .'</a>'; | |
} | |
add_shortcode( 'wplogout', 'logout_func' ); | |
?> | |
// Example Usage: | |
// [wplogout linktext="YES"] - if you don't specify linktext, will just display "Log Out" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment