How to Integrate PPWP with Jupiter X Theme

Jupiter X allows you to customize literally everything on your site using an advanced visual editor. It’s an all-in-one platform for every creator to build their dream WordPress sites fast and easy. With Jupiter X, you can create your pixel-perfect websites with ease.

By default, Password Protect WordPress (PPWP) Pro plugin only protects the content of your posts and pages. As a result, the Jupiter X layout or template applied to the posts/pages will remain visible to the public.

In order to cover the whole Jupiter X layout/template with a password form, simply add the following code snippet into the Jupiter X (child) theme’s functions.php file.

add_action('jupiterx_before_posts_loop', 'ppwp_maybe_render_password_form', 8 );
function ppwp_maybe_render_password_form() {
     if ( ! is_singular() ) {
         return;
         }
     if ( post_password_required() ) {
         echo get_the_password_form();
         exit();
         }
}

It’s worth noting that Jupiter X theme comes with a built-in page caching function to improve the speed and performance of your website. Therefore, once protected, you’d need to manually purge cache for the password form to display properly.

Lasted updated on September 7, 2020