Protecting content in custom themes
If you password protect an individual post or page in your wordpress blog, wordpress makes sure that anything returned by the_content() stays hidden from prying eyes. But what if your theme makes use of other functions that might show something else that you want to remain secure (think attachments, metaboxes, etc)? We’ll it’s not in the wordpress conditionals page, but it does exist:
if(!post_password_required()){
//your protected stuff
}
anything inside that if statement should only show up if your user logs into that post.