Skip to content

Instantly share code, notes, and snippets.

@Pross
Created June 19, 2014 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pross/4dbf4b2ee8b74ccc47ac to your computer and use it in GitHub Desktop.
Save Pross/4dbf4b2ee8b74ccc47ac to your computer and use it in GitHub Desktop.
Add a class to passworded post
<?php
add_filter( 'body_class', 'add_password_class' );
function password_class( $classes ) {
if( post_password_required() ) {
$classes[] = 'password-required';
}
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment