get_the_post_thumbnail [ WordPress Function ]
get_the_post_thumbnail ( $post_id = null, $size = 'post-thumbnail', $attr = '' )
| Parameters: |
|
| Defined at: |
Benzer Fonksiyonlar: the_post_thumbnail, set_post_thumbnail, get_post_thumbnail_id, delete_post_thumbnail, has_post_thumbnail
Retrieve Post Thumbnail.
Source
<?php
function get_the_post_thumbnail( $post_id = null, $size = 'post-thumbnail', $attr = '' ) {
$post_id = ( null === $post_id ) ? get_the_ID() : $post_id;
$post_thumbnail_id = get_post_thumbnail_id( $post_id );
$size = apply_filters( 'post_thumbnail_size', $size );
if ( $post_thumbnail_id ) {
do_action( 'begin_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size ); // for "Just In Time" filtering of all of wp_get_attachment_image()'s filters
if ( in_the_loop() )
update_post_thumbnail_cache();
$html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr );
do_action( 'end_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size );
} else {
$html = '';
}
return apply_filters( 'post_thumbnail_html', $html, $post_id, $post_thumbnail_id, $size, $attr );
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Function Reference/get the post thumbnail « WordPress Codex
get_the_post_thumbnail($id); // without parameter -> Thumbnail get_the_post_thumbnail($id, 'thumbnail'); // Thumbnail get_the_post_thumbnail($ id, 'medium'); ...
codex.wordpress.org - WordPress › Support » get_the_post_thumbnail
Member Posted 5 months ago #. Hi I'd like to modify this code to check to see if there's a featured thumbnail, and if no thumbnail use a default image. Any ideas?
wordpress.org - post thumbnails - get_the_post_thumbnail() returns nothing ...
Jul 26, 2011 ... Here's my code: function widget($args, $options) { extract($args); global $post; $ post_type = $options['post_type']; $num_of_posts ...
wordpress.stackexchange.com - How to use get_the_post_thumbnail() for WP 2.9.2 - Chinmoy29's Blog
Jul 4, 2010 ... In WordPress 2.9, the get_the_post_thumbnail is a new function that was added to allow you to select and display a post's thumbnail image.
chinmoy29.wordpress.com
Kullanýcý Tartýþmalarý [ wordpress.org ]
- baalam on "Featured Image for 3rd level pages"
- alchymyth on "Featured Image for 3rd level pages"
- baalam on "Featured Image for 3rd level pages"
- Shamel S. on "get_the_post_thumbnail hack"
- Iperdesign_IT on "[Plugin: WP Events Calendar] Call to undefined function get_the_post_thumbnail()"
- docbrandes on "get_the_post_thumbnail hack"
- alchymyth on "get_the_post_thumbnail hack"
- docbrandes on "get_the_post_thumbnail hack"
- alchymyth on "get_the_post_thumbnail hack"
- docbrandes on "Add custom variable to get_the_post_thumbnail?"