Password protected page template code not working (1 post)

  1. dave
    Posted 3 years ago #

    I'm trying to password protect a page with a custom theme and page template, but the password input field is not showing up. I checked my page template against the default WP theme page template and although they were different, they weren't far off. Mine includes the loop correctly, etc, but I still can't get the password protection to work on this page.

    Here's the code for my page template:

     * @package WordPress
     * @subpackage Adapt Theme
     * Template Name: Portfolio
    <?php get_header(); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <header id="page-heading" class="clearfix">
    	<h1><?php the_title(); ?></h1>
    		//get portfolio categories
    		$cats = get_terms('portfolio_cats');
    		//show filter if categories exist
    		if($cats[0]) { ?>
            <!-- Portfolio Filter -->
            <ul id="portfolio-cats" class="filter clearfix">
                <li><a href="#" class="active" data-filter="*"><span><?php _e('All', 'wpex'); ?></span></a></li>
                foreach ($cats as $cat ) : ?>
                <li><a href="#" data-filter=".<?php echo $cat->slug; ?>"><span><?php echo $cat->name; ?></span></a></li>
                <?php endforeach; ?>
            </ul><!-- /portfolio-cats -->
    	<?php } ?>
    <!-- /page-heading -->
    <div class="post full-width clearfix">
        <div id="portfolio-wrap" class="clearfix">
        	<div class="portfolio-content">
                //get post type ==> portfolio
                    'posts_per_page' => -1,
                while (have_posts()) : the_post();
                //get portfolio thumbnail
                $thumbail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'grid-thumb');
                //get terms
                $terms = get_the_terms( get_the_ID(), 'portfolio_cats' );
                <?php if ( has_post_thumbnail() ) {  ?>
                <article class="portfolio-item <?php if($terms) foreach ($terms as $term) echo $term->slug .' '; ?>">
                	<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                    	<img src="<?php echo $thumbail[0]; ?>" height="<?php echo $thumbail[2]; ?>" width="<?php echo $thumbail[1]; ?>" alt="<?php echo the_title(); ?>" />
                		<div class="portfolio-overlay"><h3><?php echo the_title(); ?></h3></div><!-- portfolio-overlay -->
                <?php } ?>
                <?php endwhile; ?>
            <!-- /portfolio-content -->
        <!-- /portfolio-wrap -->
    	<?php wp_reset_query(); ?>
    <!-- /post full-width -->
    <?php endwhile; ?>
    <?php endif; ?>
    <?php get_footer(); ?>

    Thanks for any help!

Topic Closed

This topic has been closed to new replies.

About this Topic