How to use the password protection feature in WP when you’re not using the_content()
<?php
/* Template Name: Landing */
/**
* Landing Content
*
*/
function ea_landing_content() {
// Password Protection
if( post_password_required() ) {
global $post;
echo '<div class="landing-section"><div class="wrap">';
echo '<h2>Password Required</h2>';
echo get_the_password_form( $post );
echo '</div></div>';
return;
}
// Landing page content
$sections = ea_cf( 'ea_landing_content', get_the_ID(), array( 'cf_type' => 'complex' ) );
//...
}
get_header();
ea_landing_content();
get_footer();