【问题标题】:What is the Featured Image area for on the TwentyTen theme using WordPress?使用 WordPress 的 TwentyTen 主题的特色图片区域是什么?
【发布时间】:2010-08-05 06:34:58
【问题描述】:

我正在使用 TwentyTen 主题作为父主题在 Wordpress 中创建子主题。我在管理部分的页面区域下看到,有一个“特色图片”区域,但我没有看到该特色图片在页面上的显示位置。

特色图片区域的用途是什么?理想情况下,我希望使用该上传器将图像放在页面上的指定位置。

在什么文件中,我可以找到页面管理区域中显示的特色图像区域的代码 php 代码?我浏览了functions.php 文件。我猜它是核心文件中的一个函数,它在二十一主题的 functions.php 文件中被调用,但我似乎看不出发生了什么。有人可以帮我吗?

【问题讨论】:

    标签: wordpress upload themes twenty-ten-theme


    【解决方案1】:

    特色图片有时也称为帖子缩略图。这显示在哪里取决于您的主题,但for TwentyTen, it replaces the default header image。你可以在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; ?>
    

    【讨论】:

      猜你喜欢
      • 2014-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-28
      • 2019-07-31
      • 2014-11-29
      • 2014-11-22
      • 2021-09-03
      相关资源
      最近更新 更多