Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/
- function get_the_post_thumbnail( $post = null, $size = 'post-thumbnail', $attr = '' ) {
- $post = get_post( $post );
- if ( ! $post ) {
- return '';
- }
- $post_thumbnail_id = get_post_thumbnail_id( $post ); // same as: get_metadata('post', $post_id, '_thumbnail_id', $single); ----- > that returns-----> $res = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
- $size = apply_filters( 'post_thumbnail_size', $size, $post->ID );
- if ( $post_thumbnail_id ) {
- do_action( 'begin_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size );
- if ( in_the_loop() )
- update_post_thumbnail_cache();
- $html = wp_get_attachment_image( $post_thumbnail_id, $size, $icon=false, $attr );
- do_action( 'end_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size );
- } else {
- $html = '';
- }
- .....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement