WordPress.org

Support

Support » How-To and Troubleshooting » Protected Page with Posts : Password form not showing

Protected Page with Posts : Password form not showing

  • Hello,

    im trying to add a password protected page to my theme on which I want to show posts, that only users who (obviously) know the password can see.

    I’ve searched and tried for a few hours now and the best solution I found is this

    <?php if(!empty($post->post_password) && $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {
    	the_content(); // this will be used to display password form
    }
    
    if (isset($_COOKIE['wp-postpass_' . COOKIEHASH]) && $_COOKIE['wp-postpass_' . COOKIEHASH] == $post->post_password) {
    
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$args= array(
    		'category_name' => 'Secret Stuff',
    		'paged' => $paged
    	);
    	query_posts($args);
    
    	[ custom query here ]
    
    	[ usual Loop here ]
    }?>

    But this doesn’t seem to work in 3.5. The Password Form doesn’t show on the protected page. Can anyone help and tell me what is wrong?

    Thanks
    MirkoE

  • The topic ‘Protected Page with Posts : Password form not showing’ is closed to new replies.
Skip to toolbar