我根据“TheDeadMedic”的建议解决了这个问题。
下面是代码。正如他所说,他在发帖时补充道。我在标题后添加了它。
<?php
/**
* Template Name: Page
*
*/
global $post;
if ( ! post_password_required( $post ) ) {
get_header();
while ( have_posts() ) { the_post(); }
?>
<div id="Content">
<div class="content_wrapper clearfix">
secured content here
</div>
</div>
<?php
get_footer();
}else{
// we will show password form here
echo get_the_password_form();
}