Skip to content

Instantly share code, notes, and snippets.

@ahmadawais
Last active October 29, 2015 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmadawais/8a629cf9571c10e8695d to your computer and use it in GitHub Desktop.
Save ahmadawais/8a629cf9571c10e8695d to your computer and use it in GitHub Desktop.
WP: Member Shortcode
<?php
/**
* Only login users can read the text shortcode.
*
* E.g. [member]This content is hiddent from users who are not logged in[/member].
*
*
* @package aa_basic_shortcodes
* @since 1.0.0
*/
function aa_login_users_only_shortcode( $atts, $content = null ) {
if ( is_user_logged_in() && !is_feed() && !is_null( $content ) )
return $content;
return '';
}
add_shortcode( 'member', 'aa_login_users_only_shortcode' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment