wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
has_post_thumbnail › WordPress Function
Seit2.9.0
Veraltetn/v
› has_post_thumbnail ( $post = null )
Parameter: |
|
Gibt zurück: |
|
Definiert in: |
|
Codex: | |
Changelog: |
|
Determines whether a post has an image attached.
For more information on this and similar theme functions, check out the {@link Conditional Tags} article in the Theme Developer Handbook.Ähnliche Funktionen: the_post_thumbnail, set_post_thumbnail, the_post_thumbnail_url, get_the_post_thumbnail, set_post_thumbnail_size
Quellcode
function has_post_thumbnail( $post = null ) { $thumbnail_id = get_post_thumbnail_id( $post ); $has_thumbnail = (bool) $thumbnail_id; /** * Filters whether a post has a post thumbnail. * * @since 5.1.0 * * @param bool $has_thumbnail true if the post has a post thumbnail, otherwise false. * @param int|WP_Post|null $post Post ID or WP_Post object. Default is global `$post`. * @param int|false $thumbnail_id Post thumbnail ID or false if the post does not exist. */ return (bool) apply_filters( 'has_post_thumbnail', $has_thumbnail, $post, $thumbnail_id ); }