Hello guys I'm new to Wordpress and I'm having some issues. I'm making a custom theme and I need one of my pages to be password protected. I've read Wordpress codex on the subject and all the threads I found here but none of them helped me. I've made custom template that I use for my page.
My custom template is mostly hard coded and doesn't have the_content.
This is my custom template https://jsbin.com/qayeso/edit?html
When I add password to a page using this template nothing happens. After reading stuff online I had the following idea.
I made another template and wanted to call my old template into it for password.
This is the code:
<?php /* Template Name: PwProtect */ ?>
<?php
global $post;
if ( ! post_password_required( $post ) ) {
// Your custom code should here
echo get_testPage();
}else{
// we will show password form here
echo get_the_password_form();
}
?>
But when I try this I get the following error:
Fatal error: Call to undefined function get_testPage() in C:\wamp\www\fresenius\wp-content\themes\fresenius\indiPartnership.php on line 8
Is there a way to make this work ? Can I make my whole custom template password protected.