Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




_wp_post_thumbnail_html [ WordPress Function ]

_wp_post_thumbnail_html ( $thumbnail_id = null, $post_id = null )
Parameters:
  • (int) $thumbnail_id ID of the attachment used for thumbnail
  • (int) $post_id ID of the post associated with the thumbnail, defaults to global $post_ID
Returns:
  • (string) html
Defined at:



Output HTML for the post thumbnail meta-box.

Source


<?php
function _wp_post_thumbnail_html$thumbnail_id null$post_id null ) {
    global 
$content_width$_wp_additional_image_sizes$post_ID;

    if ( empty( 
$post_id ) )
        
$post_id $post_ID;

    
$upload_iframe_src esc_urlget_upload_iframe_src('image'$post_id) );
    
$set_thumbnail_link '<p class="hide-if-no-js"><a title="' esc_attr__'Set featured image' ) . '" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
    
$content sprintf$set_thumbnail_link$upload_iframe_srcesc_html__'Set featured image' ) );

    if ( 
$thumbnail_id && get_post$thumbnail_id ) ) {
        
$old_content_width $content_width;
        
$content_width 266;
        if ( !isset( 
$_wp_additional_image_sizes['post-thumbnail'] ) )
            
$thumbnail_html wp_get_attachment_image$thumbnail_id, array( $content_width$content_width ) );
        else
            
$thumbnail_html wp_get_attachment_image$thumbnail_id'post-thumbnail' );
        if ( !empty( 
$thumbnail_html ) ) {
            
$ajax_nonce wp_create_nonce"set_post_thumbnail-$post_id);
            
$content sprintf$set_thumbnail_link$upload_iframe_src$thumbnail_html );
            
$content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' $ajax_nonce '\');return false;">' esc_html__'Remove featured image' ) . '</a></p>';
        }
        
$content_width $old_content_width;
    }

    return 
apply_filters'admin_post_thumbnail_html'$content );
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics