set_post_thumbnail [ WordPress Function ]
set_post_thumbnail ( $post, $thumbnail_id )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: has_post_thumbnail, the_post_thumbnail, set_post_thumbnail_size, delete_post_thumbnail, get_post_thumbnail_id
Sets a post thumbnail.
Source
<?php
function set_post_thumbnail( $post, $thumbnail_id ) {
$post = get_post( $post );
$thumbnail_id = absint( $thumbnail_id );
if ( $post && $thumbnail_id && get_post( $thumbnail_id ) ) {
$thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' );
if ( ! empty( $thumbnail_html ) ) {
return update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id );
}
}
return false;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/set post thumbnail « WordPress Codex
Description. Sets a post thumbnail. Usage. <?php set_post_thumbnail( $post, $ thumbnail_id ); ?> Parameters. $post: (int) (Post ID or object where thumbnail ...
codex.wordpress.org - #15192 (Introduce set_post_thumbnail()) – WordPress Trac
Description. We don't have a set_post_thumbnail() function yet. It's currently done using add_post_meta() directly. Attachments. 15192.diff · Download (2.9 KB) ...
core.trac.wordpress.org - set_post_thumbnail (WordPress Function) - WPSeek.com
WordPress lookup for set_post_thumbnail, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - set_post_thumbnail() WordPress function reference, arguments and ...
set_post_thumbnail( $post, $thumbnail_id ). post: (int|object) Post ID or object where thumbnail should be attached. thumbnail_id: (int) Thumbnail to attach.
queryposts.com