WordPress.org

Make WordPress Core

Ticket #11310: 11310.patch

File 11310.patch, 1.5 KB (added by ramiy, 8 years ago)
  • post-image-template.php

     
    99 * @subpackage Template
    1010 */
    1111
     12/**
     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 (true) or not (false).
     19 */
    1220function has_post_image( $post_id = NULL ) {
    1321        global $id;
    1422        $post_id = ( NULL === $post_id ) ? $id : $post_id;
    1523        return !! get_post_image_id( $post_id );
    1624}
    1725
     26/**
     27 * Retrieve Post Image ID.
     28 *
     29 * @since 2.9.0
     30 *
     31 * @param int $post_id Optional. Post ID.
     32 * @return int
     33 */
    1834function get_post_image_id( $post_id = NULL ) {
    1935        global $id;
    2036        $post_id = ( NULL === $post_id ) ? $id : $post_id;
    2137        return get_post_meta( $post_id, '_thumbnail_id', true );
    2238}
    2339
     40/**
     41 * Display Post Image.
     42 *
     43 * @since 2.9.0
     44 *
     45 * @param int $size Optional. Image size.  Defaults to 'thumbnail'.
     46 * @param int $attr Optional.
     47 */
    2448function the_post_image( $size = 'thumbnail', $attr = '' ) {
    2549        echo get_the_post_image( NULL, $size, $attr );
    2650}
    2751
     52/**
     53 * Retrieve Post Image.
     54 *
     55 * @since 2.9.0
     56 *
     57 * @param int $post_id Optional. Post ID.
     58 * @param string $size Optional. Image size.  Defaults to 'thumbnail'.
     59 * @param int $attr Optional.
     60  */
    2861function get_the_post_image( $post_id = NULL, $size = 'thumbnail', $attr = '' ) {
    2962        global $id;
    3063        $post_id = ( NULL === $post_id ) ? $id : $post_id;