简体   繁体   English

WordPress缩略图仅显示在类别页面中

[英]Wordpress thumbnail image only shows in category page

For some reason, I cannot add a thumbnail through the 'Featured Image' option. 由于某些原因,我无法通过“特色图片”选项添加缩略图。 If you take a look at this site , you'll see that there are no images in the first three posts. 如果您查看此站点 ,您会发现前三篇文章中没有图像。 My theme does support thumbnails and I have added a featured image on those three posts, but it's just not showing up. 我的主题确实支持缩略图,并且我在这三篇文章中添加了精选图片,但没有显示出来。 However, if you click on 'Movies', you'll see that the images suddenly appear. 但是,如果单击“电影”,则会看到图像突然出现。

EDIT: I believe what's causing the problem is this piece of code, the 'if condition' 编辑:我相信导致问题的是这段代码,如果条件

     <?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: Just confirmed that it is indeed the if condition that is causing the differences. EDIT2:只是确认确实是导致差异的if条件。 But I have no idea how to remove it, neither if it will affect the content (besides the images?) 但是我不知道如何删除它,也不会影响内容(除了图像?)

Edit3: So sorry, I fixed it myself. Edit3:对不起,我自己修复了它。 I probably wouldn't have solved it if I hadn't posted it though. 如果我没有发布的话,我可能不会解决。

I have no idea why the theme creators did this. 我不知道主题创作者为什么要这么做。 But anyway, anyone else using Portfolio Press and would like to have thumbnails in their posts, remove the if condition and remove one of the entry divs. 但是无论如何,其他任何使用Portfolio Press的人都希望在其帖子中显示缩略图,删除if条件并删除条目div之一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM