I have a password-protected page, for whom I'd like to use a custom template to query posts from a specific category. How can I achieve that query_posts should work only after users submit the password of the page? I'm trying with this but doesn't work (page only displays header and footer)
<?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(); ?>