mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-20 05:25:33 +00:00
Add has-post-thumbnail as a post class.
props danielbachhuber, frank-klein. fixes #18804. Built from https://develop.svn.wordpress.org/trunk@27429 git-svn-id: http://core.svn.wordpress.org/trunk@27276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f0bfa77a4a
commit
cc56dde10c
@ -304,8 +304,9 @@ function post_class( $class = '', $post_id = null ) {
|
|||||||
/**
|
/**
|
||||||
* Retrieve the classes for the post div as an array.
|
* Retrieve the classes for the post div as an array.
|
||||||
*
|
*
|
||||||
* The class names are add are many. If the post is a sticky, then the 'sticky'
|
* The class names are many. If the post is a sticky, then the 'sticky'
|
||||||
* class name. The class 'hentry' is always added to each post. For each
|
* class name. The class 'hentry' is always added to each post. If the post has a
|
||||||
|
* post thumbnail, 'has-post-thumbnail' is added as a class. For each
|
||||||
* category, the class will be added with 'category-' with category slug is
|
* category, the class will be added with 'category-' with category slug is
|
||||||
* added. The tags are the same way as the categories with 'tag-' before the tag
|
* added. The tags are the same way as the categories with 'tag-' before the tag
|
||||||
* slug. All classes are passed through the filter, 'post_class' with the list
|
* slug. All classes are passed through the filter, 'post_class' with the list
|
||||||
@ -342,9 +343,13 @@ function get_post_class( $class = '', $post_id = null ) {
|
|||||||
$classes[] = 'format-standard';
|
$classes[] = 'format-standard';
|
||||||
}
|
}
|
||||||
|
|
||||||
// post requires password
|
// Post requires password
|
||||||
if ( post_password_required($post->ID) )
|
if ( post_password_required( $post->ID ) ) {
|
||||||
$classes[] = 'post-password-required';
|
$classes[] = 'post-password-required';
|
||||||
|
// Post thumbnails
|
||||||
|
} elseif ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) ) {
|
||||||
|
$classes[] = 'has-post-thumbnail';
|
||||||
|
}
|
||||||
|
|
||||||
// sticky for Sticky Posts
|
// sticky for Sticky Posts
|
||||||
if ( is_sticky($post->ID) && is_home() && !is_paged() )
|
if ( is_sticky($post->ID) && is_home() && !is_paged() )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user