WordPress.org

Make WordPress Core

Ticket #20409: 20409.diff

File 20409.diff, 1.7 KB (added by ryan, 3 years ago)

Move functions

  • wp-includes/post-thumbnail-template.php

     
    1010 */ 
    1111 
    1212/** 
    13  * Check if post has an image attached. 
    14  * 
    15  * @since 2.9.0 
    16  * 
    17  * @param int $post_id Optional. Post ID. 
    18  * @return bool Whether post has an image attached. 
    19  */ 
    20 function has_post_thumbnail( $post_id = null ) { 
    21         return (bool) get_post_thumbnail_id( $post_id ); 
    22 } 
    23  
    24 /** 
    25  * Retrieve Post Thumbnail ID. 
    26  * 
    27  * @since 2.9.0 
    28  * 
    29  * @param int $post_id Optional. Post ID. 
    30  * @return int 
    31  */ 
    32 function get_post_thumbnail_id( $post_id = null ) { 
    33         $post_id = ( null === $post_id ) ? get_the_ID() : $post_id; 
    34         return get_post_meta( $post_id, '_thumbnail_id', true ); 
    35 } 
    36  
    37 /** 
    3813 * Display Post Thumbnail. 
    3914 * 
    4015 * @since 2.9.0 
  • wp-admin/includes/post.php

     
    11311131} 
    11321132 
    11331133/** 
     1134 * Check if post has an image attached. 
     1135 * 
     1136 * @since 2.9.0 
     1137 * 
     1138 * @param int $post_id Optional. Post ID. 
     1139 * @return bool Whether post has an image attached. 
     1140 */ 
     1141function has_post_thumbnail( $post_id = null ) { 
     1142        return (bool) get_post_thumbnail_id( $post_id ); 
     1143} 
     1144 
     1145/** 
     1146 * Retrieve Post Thumbnail ID. 
     1147 * 
     1148 * @since 2.9.0 
     1149 * 
     1150 * @param int $post_id Optional. Post ID. 
     1151 * @return int 
     1152 */ 
     1153function get_post_thumbnail_id( $post_id = null ) { 
     1154        $post_id = ( null === $post_id ) ? get_the_ID() : $post_id; 
     1155        return get_post_meta( $post_id, '_thumbnail_id', true ); 
     1156} 
     1157 
     1158/** 
    11341159 * Output HTML for the post thumbnail meta-box. 
    11351160 * 
    11361161 * @since 2.9.0