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

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.