我有一个受密码保护的页面,我想为其使用自定义模板来查询特定类别的帖子。我如何才能实现query\\u帖子只有在用户提交页面密码后才能工作?我正在尝试,但不起作用(页面仅显示页眉和页脚)
<?php
/*
Template Name: xxxx
*/
?>
<?php get_header(); ?>
<?php if ( post_password_required() ) : ?>
<?php query_posts(\'cat=9\'); ?>
<?php while ( have_posts() ) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><h1 style="padding-top:0;margin-top:-5px" class="entry-title"><?php the_title(); ?></h1></a>
<div class="entry-content" style="padding:0"><?php the_content(); ?></div>
<div class="entry-meta">
<?php edit_post_link( __( \'Edit\', \'twentyeleven\' ), \'<span class="edit-link">\', \'</span>\' ); ?>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php get_footer(); ?>