I would do it the other way around: Put the always visible text into a custom field per metabox, and protect the post content with a password.
In your theme, always show the custom field, and let WordPress handle the password protection.
Sample code for the theme:
while ( have_posts() )
{
the_post();
if ( post_password_required( $post ) )
{
print '<h1 class="post-protect-notice">' .
__( 'Protected Post', 't5_theme' )
. '</h1>';
the_excerpt();
// custom field
print wpautop(
get_post_meta( get_the_ID(), '_always_visible_content', TRUE )
);
}
else
{
// show regular content
}
}
Related Posts:
- Personalized message for each unique password-protected page
- wp_enqueue_script adding conditional statement not working
- Check if first paragraph is an image, then show custom code right after it?
- If post author role is X
- Can a conditional statement apply to part of a slug?
- Add default content to posts in a specific category?
- is_front_page, is_page(‘slug’), is_page(id) not working
- Need help on creating If-statement for custom meta fields
- How to make gravatar.com avatars conditional?
- Loading Scripts on Specific Pages
- Condition function for is parent category?
- Conditional Statement – Best Way to Remove Nav on Contact Page
- Proper syntax for simple conditional bloginfo language
- wordpress is_page() problem
- Location-Based Content
- Conditional Shortcode image display
- Change Woocommerce order button page on particular page
- Change a url / link if a user is logged in?
- to create own conditional tags for business directory in wp
- How to use “Cases” instead of “IFs” for conditional logic
- Which is the better way to write a conditional statement? [closed]
- Nested conditionals
- if/Else have_posts Else fails to echo message to page
- Conditonal statement for iPad
- Return function only on certain pages
- How to write this conditional statement?
- Conditional for Custom Post Types
- Date-Based Conditional Tag
- Message box when accessed from iPad
- Show this code if user has previously left a comment
- Insert a conditional in the middle of a function to give it 2 different outcomes
- How can I use ‘edit_form_after_title’ conditionally?
- Force Log in to view a page
- Conditional loading of CSS for my plugin
- Looks like this if condition is not working [closed]
- Generating images from an array of categories
- WP conditional site logo and header block
- How to know if the most recent article
- Widget logic conditional widget
- How to display image on condition that a selection has been made
- How to Conditionally Not Display a Link Based on Current URL?
- Allow users to only CREATE one single (custom) post
- If statement to check for post_content
- why is my custom loop failing?
- Conditional sidebar menu
- What is the best way to disable my WP website if the user has adblocker on? [closed]
- check if post is set to “password protected”
- How to tie two conditions to one statement
- Create a page from different content blocks
- Content Restriction but allow public REST API
- How do test if a post is a custom post type?
- Enqueue Scripts / Styles when shortcode is present
- Sending the reset password link programatically
- How to change user password with wp-cli?
- wp enqueue style on specific page templates
- Loading scripts only if a particular shortcode or widget is present
- Why isn’t is_page working when I put it in the functions.php file?
- Disable user registration password email
- Where to securely store API keys and passwords in WordPress?
- wordpress redirect after password reset
- Check for correct username on custom login form
- How to conditionally enqueue a stylesheet only for a certain page(s)?
- Add error message on password protected page
- Missing URL in password reset email
- Loosen/disable password policy
- Password Protect Custom Page
- How do I require authorization / login to view a specific set of posts / pages?
- Why are passwords exportable as plain text in WordPress?
- Password Reset for Users on a Multisite Subsite
- How to protect pages with double authentication: password + email (in custom field)
- Enforcing password complexity
- Password protecting a page
- How do I create a password reset link?
- Replacing the WordPress password validation
- How to save Admin FTP password
- how to create a conditional content_width for a wordpress theme?
- multi page password protection
- Hook *after* user password change?
- How can I change the default wordpress password hashing system to something custom?
- how to use joomla password format in wordpress?
- If I change the salt keys in my wp-config will all passwords break?
- Conditional to test if post has password protection enabled
- How can I determine if a post has an image attachment?
- Display navigation menu item conditionally based on user capabilities
- How to let user set password on registration
- How is password strength calculated?
- Password protect page with multiple passwords
- How do I place content on archive pages but not on main page?
- Editing ‘Password Reset’ E-mail
- Network Admin “You do not have sufficient permissions to access this page.”
- Bypass password protected posts via GET variable
- How to reset passwords for all users on a network using wp cli
- How can I safely increase the character limit for post passwords?
- If Post Type equals, then display X content
- Check the password of a user
- Best way to send users password?
- Password protected posts redirects
- How to apply the “retrieve_password_message” filter?
- Customizing lost password email
- Is it possible to direct users to a certain post based on a password entered on the home page?