Setting the Visibility of a Page or Post to 'Password protected' in WordPress will hide the content until the Password is entered by a user.
A member of GenesisWP Facebook group wrote:
I password protected some pages in my site (I'm using a customized version of Genesis Sample theme), the problem is that the sidebar is still visible.
The sidebar only displays on those pages, the rest of my pages are full widht, so the widgets I need in my sidebar are for the password protected pages only.
We can use post_password_required() function to check whether a single entry requires password and the correct password has been provided. Using this conditional in combination with actions in Genesis, Primary sidebar can be removed until the password has been entered.
Before entering password:
After entering password:
To not show the Primary Sidebar until the password has been entered, add the following in child theme's functions.php:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.