开发者

What is the Featured Image area for on the TwentyTen theme using WordPress?

I am creating a child theme in Wordpress using the TwentyTen theme as a parent. I saw under the Pages area in the admin section, there is a 'Featured Image' area, but I don't see where that featured image is shown on the page.

What is the featured image area for? I would ideally like to use that uploader to put an image at a specified location on the page.

In what file for twentyten can I find the code php code for the Featured Image area that is displayed in the pages admin area? I looked all through the functions.php file. I'm guessing it is a function in the core files and it is being called in the functions.php file in the twentyten theme, but I can't seem to s开发者_运维百科ee where that is happening. Can someone help me?


The Featured Image is sometimes called the Post Thumbnail. Where this shows up depends on your theme, but for TwentyTen, it replaces the default header image. You can see the code in use in header.php:

<?php
// Check if this is a post or page, if it has a thumbnail, and if it's a big one
if ( is_singular() &&
        has_post_thumbnail( $post->ID ) &&
        ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
        $image[1] >= HEADER_IMAGE_WIDTH ) :
    // Houston, we have a new header image!
    echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
else : ?>
    <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
<?php endif; ?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜