I tried this with my functions.php file, and couldn’t get it to work. I have already changed the default text for my protected posts, and would like to keep the new text, but also show an excerpt. I am having no luck getting it to work. Any help would be greatly appreciated.
You can view my protected post text at https://hampton-family.com/Yvette/?p=161. I would like to keep this text, but display an excerpt below it. preferably, followed by another message, to the tune of “this is just an excerpt, please log in to view the whole post”.
Here is my current functions.php file – Thanks to Otto42 for the help on this one.
<?php
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '<div class="block">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>',
));
function change_pw_text($content) {
$content = str_replace(
'This post is password protected. To view it please enter your password below:',
'<br /><b><font color="red">***This post is password protected. To view it please enter your password below.***</font></b><br /><br />
To get your password, subscribe to our newsletter. Click the <b>*FREE Newsletter and Expert Tips*</b> link at the top of this page. You will be granted <b>VIP Access</b> to all of our content.',
$content);
return $content;
}
add_filter('the_content','change_pw_text');
?>