Add Custom Class To Style Private Password Protected Posts

This PHP code generates a new custom class you can use to style all your password protected posts.

Add the class to your child themes style.css file and begin styling your password protected posts.

More Ways To Style Protected Posts

.password-protected .entry-content input {
	width: 50%;
}

.password-protected .entry-content input[type="submit"] {
        width: 20%;
}

This sample CSS simply aligns the password form inline so the submit button displays next to the input field on password protected posts only.

From this:

default form

To this:

password protected form

Remove Protected Text Before Title

This PHP code removes the Protected text before the entry title added to password protected posts.

Related Code Snippets

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.