Here is a code that will display of password protected post/page of wordpress. Use this in function.php
<?php
function display_protected_excerpts($excerpt)
{
global $post;
if (!empty($post->post_password)) {
$output = $post->post_excerpt;
$output = apply_filters(‘get_the_excerpt’, $output);
return $output;
}
return $excerpt;
}
add_filter(‘the_excerpt’,’display_protected_excerpts’, 0);
function display_excerpt_on_protected_posts($content)
{
global $post;
$replacement_text = $post->post_excerpt;
$replacement_text = apply_filters(‘get_the_excerpt’, $replacement_text);
return str_replace(‘This post is password protected. To view it please enter your password below:’,$replacement_text, $content);
}
add_filter(‘the_content’,’display_excerpt_on_protected_posts’, 10);
?>
More Post
What to consider for the development of the best travel website?
7 things to note for the development of the best travel website
7 things to consider for the development of the best travel website