如何从 Tesseract Theme 单个帖子中删除特色图片背景:
1.-首先从原始content-single.php文件中复制一份。
2.- 使用纯文本编辑器编辑 content-single.php。
3.-如果原文件是这样的:
<?php
/**
* @package Tesseract
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( has_post_thumbnail() && 'post' == get_post_type() ) {
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'tesseract-large' ); ?>
<div class="entry-background" style="background-image: url(<?php echo esc_url( $thumbnail[0] ); ?>)">
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
</div><!-- .entry-background -->
<?php } else { ?>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<?php } ?>
<div class="entry-content">
<div class="entry-meta">
<?php tesseract_posted_on(); ?>
</div><!-- .entry-meta -->
<?php the_content(); ?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'tesseract' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
</article><!-- #post-## -->
(来源:github.com/Conutant/TESSERACT/blob/Master_Branch/content-single.php)
4.- 要移除特色图片背景,请将其更改为:
<?php
/**
* @package Tesseract
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<div class="entry-meta">
<?php tesseract_posted_on(); ?>
</div><!-- .entry-meta -->
<?php the_content(); ?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'tesseract' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
</article><!-- #post-## -->
5.- 请记住,当您将主题更新到新版本时,所有更改都将被覆盖。避免这种情况的一个好选择是创建子主题,这是修改现有主题的推荐方法。更多信息请访问:https://codex.wordpress.org/Child_Themes
6.-测试一下,如果有任何问题,请告诉我。
问候。