rrsitemaps
Forum Replies Created
-
Forum: Plugins
In reply to: Show Teaser on Password protected postsI 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'); ?>
Forum: Installing WordPress
In reply to: How can i change the “this post is password protected” messageThe advice at https://www.ads-software.com/support/topic/99463i still works. This was a really helpful thread. I was able to change my “protected post” text and add information on how to subscribe to my “VIP” content, which clarified for my visitors, where they needed to get the password for the post. It was exactly what I was looking for. Thanks Otto for the great advice
You can view how I used this in my page at https://hampton-family.com/Yvette/?p=161
My functions.php file looks like this now
<?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:', '<b><font color="red">***This post is password protected. To view it please enter your password below.***</font></b> 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'); ?>
Look at the support thread linked above. Otto explains how to modify or create the “functions.php” file to make this work. It is a lot easier than it looks.