I am working on a wordpress site for a client who wants an internal ‘intranet’ for his employees. The basic needs are:
- Communicate things in-house
- House important company documents
- Provide quick access to resources to employees.
This info is sensitive and for employees only. They would like each employee to have a user name / password and only be able to view information and documents once they are logged in.
I saw these plugins, and a few like it, but they seems limited, and of course they’re completely out-dated now:
- http://wordpress.org/extend/plugins/wp-require-auth/
- http://wordpress.org/extend/plugins/members-only/
I know I can password-protect individual posts / pages. Can I password protect an entire category of posts, or better yet a custom post-type? Basically, I need to group some pages / posts together under a login. The information is sensitive so it can’t be available, for instance in the RSS feed. How can I do this?
- Option 1 (less desirable): have an entire wordpress build behind a
login wall - Option 2 (more desirable): have just the internal pages /
posts behind the login wall
Bottom line: I’m interested in option 1 if it’s WAY easier, but would prefer option 2. Currently, after some research, I’m only finding out of date plugins that help with this, and can’t seem to find a reliable way to pull either one off. Thanks for your help!
6 s
This is just a modification of timshutes’ answer – if you want specific pages to require login and don’t want to put them into a custom post type, you can add to functions.php:
add_shortcode('need_login', 'shortcode_needLogin');
function shortcode_needLogin() {
if (!is_user_logged_in()) {
auth_redirect();
}
}
And then at the top of the pages you want to require login for, you can just do:
[need_login]