Members only content

If you want to create some private content that only registered users are able to see, the following shortcode is the solution to your problem. Paste the code below into your functions.php file in order to create the shortcode:

 
function cwc_member_check_shortcode( $atts, $content = null ) {
	 if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
		return $content;
	return '';
}
 
add_shortcode( 'member', 'cwc_member_check_shortcode' );

Then, proceed as shown below to create some member-only content:

[member]This text will be only displayed to registered users.[/member]