以下一行程序删除常规标题图像:
! is_admin() && is_front_page() && add_filter( \'theme_mod_header_image\', \'__return_false\' );
通常,标题图像是根据
Theme Modification API, 提供相同的过滤方案
"theme_mod_$name"
对于所有主题数据。
更新
我现在明白了,主题是在单个视图上使用帖子缩略图作为标题图像:
<?php
// Check if this is a post or page, if it has a thumbnail, and if it exceeds defined HEADER_IMAGE_WIDTH
if ( is_singular() && current_theme_supports( \'post-thumbnails\' ) && 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!
$image_attr = array(
\'class\' => "scale-with-grid",
\'alt\' => trim(strip_tags( $attachment->post_excerpt )),
\'title\' => trim(strip_tags( $attachment->post_title ))
);
echo \'<div id="header_image" class="row sixteen columns">\'.get_the_post_thumbnail( $post->ID, array("HEADER_IMAGE_WIDTH","HEADER_IMAGE_HEIGHT"), $image_attr ).\'</div>\';
elseif ( get_header_image() ) : ?>
<div id="header_image" class="row sixteen columns"><img class="scale-with-grid round" src="<?php header_image(); ?>" alt="" /></div>
<?php endif; ?>
您必须删除子主题中的代码,并将其替换为:
if ( is_front_page() && get_header_image() )
{
?>
<div id="header_image" class="row sixteen columns">
<img class="scale-with-grid round" src="<?php header_image(); ?>" alt="" />
</div>
<?php
}