Make WordPress Core


Ignore:
Timestamp:
11/01/2009 10:10:06 AM (17 years ago)
Author:
westi
Message:

Introduce require_if_theme_supports(), move post thumbnails functions to there own include and only included them if the theme supports them. See #10928 and [12132]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post-template.php

    r12105 r12134  
    882882
    883883//
    884 // Post images
    885 //
    886 
    887 function has_post_image( $post_id = NULL ) {
    888     global $id;
    889     $post_id = ( NULL === $post_id ) ? $id : $post_id;
    890     return !! get_post_image_id( $post_id );
    891 }
    892 
    893 function get_post_image_id( $post_id = NULL ) {
    894     global $id;
    895     $post_id = ( NULL === $post_id ) ? $id : $post_id;
    896     return get_post_meta( $post_id, '_thumbnail_id', true );
    897 }
    898 
    899 function the_post_image( $size = 'thumbnail', $attr = '' ) {
    900     echo get_the_post_image( NULL, $size, $attr );
    901 }
    902 
    903 function get_the_post_image( $post_id = NULL, $size = 'thumbnail', $attr = '' ) {
    904     global $id;
    905     $post_id = ( NULL === $post_id ) ? $id : $post_id;
    906     $post_image_id = get_post_image_id( $post_id );
    907     $size = apply_filters( 'post_image_size', $size );
    908     if ( $post_image_id ) {
    909         do_action( 'begin_fetch_post_image_html', $post_id, $post_image_id, $size ); // for "Just In Time" filtering of all of wp_get_attachment_image()'s filters
    910         $html = wp_get_attachment_image( $post_image_id, $size, false, $attr );
    911         do_action( 'end_fetch_post_image_html', $post_id, $post_image_id, $size );
    912     } else {
    913         $html = '';
    914     }
    915     return apply_filters( 'post_image_html', $html, $post_id, $post_image_id );
    916 }
    917 
    918 //
    919884// Attachments
    920885//
Note: See TracChangeset for help on using the changeset viewer.