slide1-600x290

Hello Guys, today i am going to explain you simple logic on making blog page passport protected.

Step 1: select one of the page as post page. You can select this from dashboard -> setting -> reading -> post page section

display-blog

step 2: Then you need to find which template is in use to display post page. See here for template heirarchy https://developer.wordpress.org/themes/basics/template-hierarchy/

And add this following condition just before the post loop:

// Start the loop.
while ( have_posts() ) : the_post();

//content

endwhile;
endif;
}
Note: Here on function parameter-post_password_required we had provided the post id of blog page ie : 226.blog-password

Please refer this article for making page as passport protected: https://codex.wordpress.org/Using_Password_Protection.

Let me know if you have any question or queries, i will be more than glad to assist you on this stuff.

Thanks

Advertisements