Last active
December 21, 2021 07:30
-
-
Save braddalton/bfc099559bec0b7fc97c to your computer and use it in GitHub Desktop.
Add Class To Password Protected Posts http://wpsites.net/web-design/add-custom-class-to-style-password-protected-posts/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'body_class', 'add_password_protected_body_class' ); | |
function add_password_protected_body_class( $classes ) { | |
if ( post_password_required() ) | |
$classes[] = 'password-protected'; | |
return $classes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment