Title: Password protected post w/ CSS styling
Last modified: August 20, 2016

---

# Password protected post w/ CSS styling

 *  [rdembrun](https://wordpress.org/support/users/rdembrun/)
 * (@rdembrun)
 * [14 years, 12 months ago](https://wordpress.org/support/topic/password-protected-post-w-css-styling/)
 * I am a photographer and am trying to password protect albums (which are ultimately
   new pages that are password protected). I though I had figured it out with a 
   filter in php and then added a class in css, so now I have it looking the way
   I want, but once I enter the password, I get an error that reads:
    ‘Warning: 
   Cannot modify header information – headers already sent by (output started at/
   home2/dreamwe6/public_html/wp-content/themes/Dream-Photo-Theme/functions.php:
   12) in /home2/dreamwe6/public_html/wp-pass.php on line 16’
 * Here’s the php I’m using:
 *     ```
       <?php
       add_filter( 'the_password_form', 'custom_password_form' );
       function custom_password_form() {
       	global $post;
       	$label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
       	$o = '<form class="protected-post-form" action="' . get_option('siteurl') . '/wp-pass.php" method="post">
       	' . __( "This album is password protected. <br/> To view the album please enter the groom's last name:" ) . '
       	<label for="' . $label . '">' . __( "" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
       	</form>
       	';
       	return $o;
       }
       ?>
       ```
   
 * Any help?

Viewing 1 replies (of 1 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 12 months ago](https://wordpress.org/support/topic/password-protected-post-w-css-styling/#post-2143476)
 * [http://codex.wordpress.org/FAQ_Troubleshooting#How_do_I_solve_the_Headers_already_sent_warning_problem.3F](http://codex.wordpress.org/FAQ_Troubleshooting#How_do_I_solve_the_Headers_already_sent_warning_problem.3F)

Viewing 1 replies (of 1 total)

The topic ‘Password protected post w/ CSS styling’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [14 years, 12 months ago](https://wordpress.org/support/topic/password-protected-post-w-css-styling/#post-2143476)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
