Password Protected Content

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();
Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk