Last active
August 29, 2015 14:18
-
-
Save danielmcclure/5b277f0f0553a584aa7f to your computer and use it in GitHub Desktop.
Shortcode To Only Display Content When User Is Logged In / Out
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
//* Add logged in content shortcode | |
function tme_is_logged_in ($params, $content = null) { | |
if ( is_user_logged_in() ){ | |
return $content; | |
} else { | |
return; | |
} | |
} | |
add_shortcode('isloggedin', 'tme_is_logged_in' ); | |
//* Add logged out content shortcode | |
function tme_is_logged_out ($params, $content = null) { | |
if ( !is_user_logged_in() ){ | |
return $content; | |
} else { | |
return; | |
} | |
} | |
add_shortcode('isloggedout', 'tme_is_logged_out' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment