I've trying to find out how to do this in wordpress and I've searched the web, but I can't find any easy way to make my visitor only see one link if they enter a password to be able to see it.
Is there any plugin or solution that could do that ?
I've trying to find out how to do this in wordpress and I've searched the web, but I can't find any easy way to make my visitor only see one link if they enter a password to be able to see it.
Is there any plugin or solution that could do that ?
I think this is almost what the article Add Private Content to Posts via Shortcode talks about. But it's only for registered users:
add_shortcode('private', 'private_content');
function private_content($atts, $content = null) {
if ( is_user_logged_in() )
return '<div class="private-content">' . $content . '</div>';
return '';
}
And used inside the post/page like:
[private]
This post contains registered-only content!
[/private]
To add a password functionality, you'd have to add a <form>
inside the shortcode function and show the content after the password is successfully $_POST
ed.
Maybe it's more straight forward using Ajax.