Do you want to:
A) Force login for some Pages?
B) Force login for all Pages?
C) Force login for all Site Content?
D) Just add a password to a particular Page or 2?
http://codex.wordpress.org/Content_Visibility
1. Have you setup a Child Theme? Does your theme support one?
2. Will instructions on how to customize your site with PHP be useful or would you prefer a plugin type of fix?
Thread Starter
jbwp11
(@jbwp11)
I have a my-custom-css.
I already have a password-protect mentioned in the content-visibility link above, but I’m looking to provide a user-specific login/password access to a few pages on the website.
Visit to the website would show limited content on the webpages and a user-password form to login. Once logged in all pages would show full content. How can I do this?
Thread Starter
jbwp11
(@jbwp11)
I used the following on all pages I want restricted. But the login-form does not show when the user is not verified. Can i do this without plugin?
<?php
if ( is_user_logged_in() ) :
?>
Example content here
<?php
else:
wp_login_form( array( 'echo' => false ) );
endif;
?>
Thread Starter
jbwp11
(@jbwp11)
I added the folowing to functions.php. Is that the right place and what advantage does plugin have?
add_action( 'init', 'my_add_shortcodes' );
function my_add_shortcodes() {
add_shortcode( 'my-login-form', 'my_login_form_shortcode' );
}
function my_login_form_shortcode() {
if ( is_user_logged_in() )
return '';
return wp_login_form( array( 'echo' => false ) );
}