• I want to have a page/post private, if readers want to see the contents of that page they have to register on to the site to see what is written

Viewing 3 replies - 1 through 3 (of 3 total)
  • May be wrong, but I think you can only do it either one way or the other – either anybody can read all posts, or everybody has to be logged in to read any post.

    From the Codex for Writing Posts

    Publish box
    Visibility – This determines how your post appears to the world. Public posts will be visible by all website visitors once published. Password Protected posts are published to all, but visitors must know the password to view the post content. Private posts are visible only to you (and to other editors or admins within your site)

    Have you looked at plugins, as what you want is surely not that unusual?

    Thread Starter b1gft

    (@b1gft)

    I was thinking if i made a sub domain and made that sub domain private to read, well that covers what you say either anybody can read all posts, or everybody has to be logged in to read any post.

    So if I do a sub domain how do I make that site private to view only for sign in members.

    I can’t see it on my blog right now, but I’m pretty sure it’s just a tick box for ‘users must be logged in to see posts’.

    Failing that, you could do a check in index.php to see if there is a logged in user, and if not display an error message and the login screen. In fact, you could just run that check anyway if you were to specify the post ID’s that you wanted for that.

    Or even take it to the next step – copy index.php and rename it, give it a template name, and add some code to check if a user is logged in then. You’d need to install the ‘Custom Post Templates’ plugin, and then all you do is select the template for private posts on the ones that you want to only be visible to logged in users.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to have page private.’ is closed to new replies.