Advertisement
retesere20

---recycler-----

Jul 7th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1.  
  2. // https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/
  3.  
  4. function get_the_post_thumbnail( $post = null, $size = 'post-thumbnail', $attr = '' ) {
  5. $post = get_post( $post );
  6. if ( ! $post ) {
  7. return '';
  8. }
  9. $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 );
  10.  
  11. $size = apply_filters( 'post_thumbnail_size', $size, $post->ID );
  12.  
  13. if ( $post_thumbnail_id ) {
  14.  
  15. do_action( 'begin_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size );
  16. if ( in_the_loop() )
  17. update_post_thumbnail_cache();
  18. $html = wp_get_attachment_image( $post_thumbnail_id, $size, $icon=false, $attr );
  19. do_action( 'end_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size );
  20.  
  21. } else {
  22. $html = '';
  23. }
  24. .....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement