隐藏来自 post [Tesseract] 的特色图片
Hide featured image from post [Tesseract]
我想在所有帖子中隐藏精选图片。我尝试了 Hide feautered image 插件。还有一些来自类似帖子的公式,例如:
.blog .entry-thumbnail { display: none; }
但是没用。
我的内容单个文件如下:
<?php
/**
* @package Tesseract
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php $featImg_pos = get_theme_mod('tesseract_blog_featimg_pos');
if ( has_post_thumbnail() && ( !$featImg_pos || ( $featImg_pos == 'above' ) ) )
tesseract_output_featimg_blog(); ?>
<?php //if ( my_theme_show_page_header() ) : ?>
<header class="entry-header">
<?php the_title( '<div id="blogpost_title"><h1 class="entry-title">', '</h1></div>' ); ?>
<?php
$postDate = get_theme_mod('tesseract_blog_date');
if ( $postDate == 'showdate' ) { ?>
<span><i class="fa fa-calendar" aria-hidden="true"></i><?php the_time('F j, Y'); ?></span>
<?php } ?>
<?php
$postAuthor = get_theme_mod('tesseract_blog_author');
if ( $postAuthor == 'showauthor' ) { ?>
<span><i class="fa fa-user" aria-hidden="true"></i><?php the_author(); ?></span>
<?php } ?>
<?php
$mypostComment = get_theme_mod('tesseract_blog_comments');
if ( ( $mypostComment == 'showcomment' ) && ( comments_open() ) ) { ?>
<span><i class="fa fa-comments-o" aria-hidden="true"></i><?php //comments_number('(No Comments)', '(1 Comment)', '(% Comments)' );?><?php comments_popup_link(
'No comments exist', '1 comment', '% comments'); ?></span>
<?php }
?>
</header><!-- .entry-header -->
<?php //endif; ?>
<?php if ( has_post_thumbnail() && ( $featImg_pos == 'below' ) )
tesseract_output_featimg_blog(); ?>
<div class="entry-content">
<div class="entry-meta">
<?php tesseract_posted_on(); ?>
</div><!-- .entry-meta -->
<?php if ( has_post_thumbnail() && ( $featImg_pos == 'left' ) ) { ?>
<div class="myleft">
<?php tesseract_output_featimg_blog(); ?>
<?php the_content(); ?>
<?php the_tags()?>
</div>
<?php } elseif ( has_post_thumbnail() && ( $featImg_pos == 'right' ) ){ ?>
<div class="myright">
<?php tesseract_output_featimg_blog(); ?>
<?php the_content(); ?>
<?php the_tags()?>
</div>
<?php } else { ?>
<?php the_content(); ?>
<?php } ?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'tesseract' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
</article><!-- #post-## -->
比较复杂,请问大家知道怎么解决吗?
尝试注释掉 tesseract_output_featimg_blog();
的行,这样:
<?php tesseract_output_featimg_blog(); ?>
变成这样:
<?php /* tesseract_output_featimg_blog(); */ ?>
我看到了 4 处,看起来它们与主题中不同的特色图片位置有关。
附带说明一下,不建议更改主题文件,除非您是在子主题中进行更改。
一些主题为他们的用户提供了一个选项,让他们可以选择是否真的想为他们的 post 使用特色图片。如果您刚刚开始使用 blog/website,我宁愿建议您搜索一个这样的 wordpress 主题。
此外,与@Jonathan 的观点一致,我还建议不要摆弄您的主题文件。几天前,出于与您相同的原因,我尝试更改主题文件,但最终破坏了我的主题代码。结果,我无法登录我的博客。所以,还是小心点好。
我想在所有帖子中隐藏精选图片。我尝试了 Hide feautered image 插件。还有一些来自类似帖子的公式,例如:
.blog .entry-thumbnail { display: none; }
但是没用。
我的内容单个文件如下:
<?php
/**
* @package Tesseract
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php $featImg_pos = get_theme_mod('tesseract_blog_featimg_pos');
if ( has_post_thumbnail() && ( !$featImg_pos || ( $featImg_pos == 'above' ) ) )
tesseract_output_featimg_blog(); ?>
<?php //if ( my_theme_show_page_header() ) : ?>
<header class="entry-header">
<?php the_title( '<div id="blogpost_title"><h1 class="entry-title">', '</h1></div>' ); ?>
<?php
$postDate = get_theme_mod('tesseract_blog_date');
if ( $postDate == 'showdate' ) { ?>
<span><i class="fa fa-calendar" aria-hidden="true"></i><?php the_time('F j, Y'); ?></span>
<?php } ?>
<?php
$postAuthor = get_theme_mod('tesseract_blog_author');
if ( $postAuthor == 'showauthor' ) { ?>
<span><i class="fa fa-user" aria-hidden="true"></i><?php the_author(); ?></span>
<?php } ?>
<?php
$mypostComment = get_theme_mod('tesseract_blog_comments');
if ( ( $mypostComment == 'showcomment' ) && ( comments_open() ) ) { ?>
<span><i class="fa fa-comments-o" aria-hidden="true"></i><?php //comments_number('(No Comments)', '(1 Comment)', '(% Comments)' );?><?php comments_popup_link(
'No comments exist', '1 comment', '% comments'); ?></span>
<?php }
?>
</header><!-- .entry-header -->
<?php //endif; ?>
<?php if ( has_post_thumbnail() && ( $featImg_pos == 'below' ) )
tesseract_output_featimg_blog(); ?>
<div class="entry-content">
<div class="entry-meta">
<?php tesseract_posted_on(); ?>
</div><!-- .entry-meta -->
<?php if ( has_post_thumbnail() && ( $featImg_pos == 'left' ) ) { ?>
<div class="myleft">
<?php tesseract_output_featimg_blog(); ?>
<?php the_content(); ?>
<?php the_tags()?>
</div>
<?php } elseif ( has_post_thumbnail() && ( $featImg_pos == 'right' ) ){ ?>
<div class="myright">
<?php tesseract_output_featimg_blog(); ?>
<?php the_content(); ?>
<?php the_tags()?>
</div>
<?php } else { ?>
<?php the_content(); ?>
<?php } ?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'tesseract' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
</article><!-- #post-## -->
比较复杂,请问大家知道怎么解决吗?
尝试注释掉 tesseract_output_featimg_blog();
的行,这样:
<?php tesseract_output_featimg_blog(); ?>
变成这样:
<?php /* tesseract_output_featimg_blog(); */ ?>
我看到了 4 处,看起来它们与主题中不同的特色图片位置有关。
附带说明一下,不建议更改主题文件,除非您是在子主题中进行更改。
一些主题为他们的用户提供了一个选项,让他们可以选择是否真的想为他们的 post 使用特色图片。如果您刚刚开始使用 blog/website,我宁愿建议您搜索一个这样的 wordpress 主题。
此外,与@Jonathan 的观点一致,我还建议不要摆弄您的主题文件。几天前,出于与您相同的原因,我尝试更改主题文件,但最终破坏了我的主题代码。结果,我无法登录我的博客。所以,还是小心点好。