Password Protected Page Messages
-
Hi,
We have 2 password protected page on our site, and we need to have a different message on each page.
I have tried to create a function for this, but for some reason the same message displays on both pages, rather than different messages for each. This is the code I am using:
function change_pw_text($content) {
if ( !is_page(‘travel-agent’) )
return $content;$find = ‘This content is password protected. To view it please enter your password below:’;
$replace = ‘<p style=”text-align: center;”><span style=”font-size: 18pt;”>
Welcome Travel Agents! </span></p>
At Present, Our Travel Agents Portal is only accessible to registered Travel Agents. To access the Portal, please enter your password below.To request a login for our Travel Agents Page, please email our Travel Agents Desk.
Our Travel Agent Booking Site is planned for the future! At this time, Travel Agents – please register your client bookings by sending an email to (email visible only to moderators and staff)
Register as a Travel Agent | Register your Travel Agency‘;
if ( !is_page(‘dance-instructor-portal’) )
return $content;$find = ‘This content is password protected. To view it please enter your password below:’;
$replace = ‘Welcome Dance Instructors. To view this portal, please enter the password below:’;
$content = str_replace( $find, $replace, $content );return $content;
}Pages in Question:
Can anyone advise where I am going wrong? Thank you.
-
Hello, I’m sorry to hear that you are having trouble with your website. However, your site is not hosted with WordPress.com. It is a site using the open-source WordPress software (from WordPress.org) but hosted elsewhere.
To clear up any confusion, WordPress.com and WordPress.org are two different entities: https://wordpress.com/support/com-vs-org/
WordPress.org has complete documentation for self-hosted/installed versions of WordPress.org at https://wordpress.org/support/ and support at https://wordpress.org/support/forums/
-
- The topic ‘Password Protected Page Messages’ is closed to new replies.