This topic has 1 reply, 2 voices, and was last updated 9 years by sharmstr.

  • Author
  • #33101
     briceemry
    Participant

    Hello!
    How to make parts of content visible for members only. Is there a shortcode to hide a portion of an article and require registration to read more?
    Thanks!

    #33478
     sharmstr
    Moderator

    If you cant find a plugin that will do that, then you’ll have to add a conditional check to the template files where it calls the_content (there are a lot of them). Off the top of my head it should be something like

    COPY CODE
    
    if ( is_user_logged_in() ) {
    	the_content();
    } else {
           get_the_excerpt();
           echo "Please log in to read the rest of the article";	
    }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?