从帖子中删除精选图片,但将其留在索引页面上

时间:2014-09-28 05:17:06

标签: wordpress wordpress-theming

我有以下blog post index page。它会在帖子文本之前加载特色图片。

post itself上 - 我希望功能图片加载。我相信这涉及编辑此content.php file (attached here),但我无法弄清楚如何执行此操作,使得图像仅在索引页面上加载而不在帖子页面上加载。任何帮助将不胜感激。

3 个答案:

答案 0 :(得分:1)

第24行

上添加以下代码代替 the_post_thumbnail('serene-featured-image');

第24行替换为以下代码:

<?php 
    if ( ! is_single() ) :
        the_post_thumbnail( 'serene-featured-image' );
    endif;
?>

答案 1 :(得分:0)

single.php(博客文章的Deatil页面)

中注释掉此代码
<div class="main-image<?php if ( '' == get_the_post_thumbnail() && 'video' === get_post_format() ) echo ' et_video_only'; ?>">



<?php if ( 'video' === get_post_format() && false !== ( $first_video = et_get_first_video() ) ) : ?>
    <div class="et-video-container">
        <?php echo $first_video; ?>
    </div>
    <?php endif; ?>

    <?php if ( ! is_single() || ! 'video' !== get_post_format() ) : ?>
    <a href="<?php the_permalink(); ?>" class="et-main-image-link">
    <?php endif; ?>

        <?php the_post_thumbnail( 'serene-featured-image' ); ?>

        <?php serene_post_meta_info(); ?>

    <?php if ( isset( $first_video ) && $first_video ) : ?>
        <span class="et-play-video"></span>
    <?php endif; ?>

    <?php if ( ! is_single() || ! 'video' !== get_post_format() ) : ?>
    </a>
    <?php endif; ?>

</div> <!-- .main-image -->

答案 2 :(得分:0)

您必须找到函数the_post_thumbnail的所有匹配项并将其删除。 有趣的文件是:

  1. single.php中
  2. page.php文件
  3. content.php
  4. 内容gallery.php
  5. 内容audio.php
  6. 的functions.php
  7. 同时检查get_the_post_thumbnail

相关问题