mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Posts: Add post class for password protected posts.
Up until now password protected posts would only get a identifying class when the password was still required. This adds a class for the case when that requirement has been met. For the other visibility types we already have `status-publish` and `status-private`. Props mdgl, F4rkie, wonderboymusic for initial patches. Fixes #21899. Built from https://develop.svn.wordpress.org/trunk@34881 git-svn-id: http://core.svn.wordpress.org/trunk@34846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a93ec5244d
commit
442c393599
@ -451,11 +451,17 @@ function get_post_class( $class = '', $post_id = null ) {
|
|||||||
$classes[] = 'format-standard';
|
$classes[] = 'format-standard';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post requires password
|
$post_password_required = post_password_required( $post->ID );
|
||||||
if ( post_password_required( $post->ID ) ) {
|
|
||||||
|
// Post requires password.
|
||||||
|
if ( $post_password_required ) {
|
||||||
$classes[] = 'post-password-required';
|
$classes[] = 'post-password-required';
|
||||||
// Post thumbnails
|
} elseif ( ! empty( $post->post_password ) ) {
|
||||||
} elseif ( ! is_attachment( $post ) && current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) ) {
|
$classes[] = 'post-password-protected';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Post thumbnails.
|
||||||
|
if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ! is_attachment( $post ) && ! $post_password_required ) {
|
||||||
$classes[] = 'has-post-thumbnail';
|
$classes[] = 'has-post-thumbnail';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-34880';
|
$wp_version = '4.4-alpha-34881';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user