You should probably add in more checks, but this should get you started.
function change_pw_text($content) {
// Just to save processing other pages.
if ( !is_page('page-slug-one') && !is_page('page-slug-two') )
return $content;
$find = 'This post is password protected. To view it please enter your password below:';
if ( is_page('page-slug-one') )
$replace="Hint: Tell our system to show you, and it will.";
if ( is_page('page-slug-two') )
$replace="Sorry: This page requires you to be logged in.";
$content = str_replace( $find, $replace, $content );
return $content;
}
add_filter('the_content','change_pw_text');
For a nice resource on the possible Conditional Tags in WordPress see… http://codex.wordpress.org/Conditional_Tags
Related Posts:
- Is there a way to password-protect part of a post?
- 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”
- Enforcing password complexity
- How do I place content on archive pages but not on main page?
- Password change when the user login first time
- How to customise wp-login.php only for users who are setting a password for the first time?
- how to test for attached image
- How to shorten length of auto generated password sent during registration?
- How Can I Register Menus and Widgets Conditionally Based on Theme Options/Settings?
- Lost password link is redirecting to /shop/my-account/lost-password/
- Checking if a Page has an Associated Term?
- Set content type to HTML for lost password email only
- How to create a word press user with hashedpassword
- Make post password required to publish
- How to verify password outside WordPress?
- Is there a way to have admins that are logged in to wordpress not have to enter the password for password protected pages while browsing the website?
- Search result conditonal tag
- How do I properly update the WordPress database password?
- Password Protected page not asking for a password
- What is the correct way to write this conditional statement?
- How to get user password before being encrypted outside the wordpress core once add a new user from dashboard?
- Adding a Cookie Session to Shortcode Content
- How to change password
- Convert user passwords to MD5?
- How to replace “Password Protected” text with icon in Admin
- Changing select options based on previous select with PHP & AJAX
- Specific coditional usage [closed]
- How to check user’s password?
- What’s the algorithm to verify user password?
- Clients with empty username are not receiving request new password email
- Conditional/Check: IF author has no First Name THEN
- award points to a user each time they update their cpt post
- Home Page Template – Specific Category
- Changing old email to new email, lost the password
- Custom template for password protected page
- Limit page template choice by page title or ID?
- Allow all reset password links within the past 24 hours to be valid and accepted
- Wrong activation/confirmation link in email
- change user password REST API
- Create Member who can’t be changed
- $expiration_duration = apply_filters( ‘password_reset_expiration’, DAY_IN_SECONDS );
- Custom get_the_password_form
- Members-only page, but accessible via sharable link
- On local machine can’t log in or reset password but I can log in on the live version, user has activation key in database
- Jetpack: Display Site Title when no Site Logo
- Best Method to Switch Between Terms (Custom Taxonomy)
- Redirect after user changes password
- How to make future posts visible to selected visitors without login
- Cannot login with correct username and password anymore
- Want to display page content after password prompt without page reload
- Password-protected Posts lead to 404 Error
- How do I reformat this to add php inside php?
- My WP site and password was hacked, what to do? [closed]
- Dynamic Buttons According to URL parameter
- Why can’t I create an Application Password?