Return to Snippet

Revision: 27603
at June 17, 2010 14:53 by themolitor


Initial Code
//FUNCTION.PHP
function member_check_shortcode($atts, $content = null) {
  if (is_user_logged_in() && !is_null($content) && !is_feed()) {
    return $content;
  } else {
    return 'Sorry, this part is only available to our members. Click here to become a member!';
}

add_shortcode('member', 'member_check_shortcode');

//add the following to your posts to create a section or text (or any other content) that will be displayed only to registered users:

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

Initial URL

                                

Initial Description

                                

Initial Title
WordPress: Member Only Content

Initial Tags
wordpress

Initial Language
PHP