【问题标题】:Wordpress thumbnail image only shows in category pageWordpress 缩略图仅显示在类别页面中
【发布时间】:2013-12-21 15:12:01
【问题描述】:

由于某种原因,我无法通过“精选图片”选项添加缩略图。如果您查看this site,您会发现前三个帖子中没有图像。我的主题确实支持缩略图,并且我在这三个帖子上添加了一张特色图片,但它只是没有显示出来。但是,如果您单击“电影”,您会看到图像突然出现。

编辑:我认为导致问题的原因是这段代码,即“if 条件”

     <?php if ( is_archive() || is_search() ) : // Only display Excerpts for archives & search ?>
<div class="entry-summary">
    <?php if ( has_post_thumbnail() && !post_password_required() ) { ?>
        <a href="<?php the_permalink() ?>" rel="bookmark" class="thumb"><?php the_post_thumbnail( 'portfolio-thumbnail-fullwidth' ); ?></a>

    <?php } ?>
    <?php the_excerpt( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'portfoliopress' ) ); ?>
  </div><!-- .entry-summary -->
   <?php else : ?>
    <div class="entry-content">
    <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'portfoliopress' ) ); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'portfoliopress' ), 'after' => '</div>' ) ); ?>
   </div><!-- .entry-content -->
    <?php endif; ?>

EDIT2:刚刚确认确实是 if 条件导致了差异。但我不知道如何删除它,它是否会影响内容(除了图像?)

Edit3:很抱歉,我自己修好了。如果我没有发布它,我可能不会解决它。

【问题讨论】:

  • 您是否使用post-formats 并且有不同的content-*.php 模板?
  • 是的,主题支持 4 种格式 + 1 种特殊格式。但我尝试对所有 5 个图像都使用特色图像。结果相同。

标签: php wordpress image thumbnails


【解决方案1】:

我不知道主题创建者为什么这样做。但无论如何,其他任何使用 Portfolio Press 并希望在他们的帖子中包含缩略图的人,删除 if 条件并删除其中一个条目 div。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多