【问题标题】:Images aren't shown in category-view (WordPress)图像未显示在类别视图中 (WordPress)
【发布时间】:2012-01-30 11:38:59
【问题描述】:

几个月来,我现在有了一个基于 wordpress 的 iOS 应用评论博客。 (几乎)所有文章都以应用程序的图像开头。这些图像在主页上可见,但在类别视图中,这些图像被隐藏或不存在。我需要这个类别页面来在 iOS 和 Mac OS 应用程序之间切换,如果图像也能显示在那里会很好。

主页:http://iapptipps.de/ 分类页面:http://iapptipps.de/category/ios/

我怎样才能改变它?它是由 WordPress 还是主题引起的?感谢您的回答!

categories.php的代码:

<?php /* Start the Loop */ ?>
            <?php while ( have_posts() ) : the_post(); ?>           
                <?php get_template_part( 'content', get_post_format() ); ?>
            <?php endwhile; ?>

这里是 content.php(显示图片的地方):

<div class="entry-content">
            <?php if ( has_post_thumbnail() ): ?>
            <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a>
            <?php endif; ?>
            <?php the_content( __( 'Continue Reading &rarr;', 'bugis' ) ); ?>
            <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'bugis' ), 'after' => '</div>' ) ); ?>
        </div>

【问题讨论】:

    标签: php html image wordpress


    【解决方案1】:

    这是由主题引起的。如果您查看主题文件夹并寻找(我相信)archives.php。您需要在希望图像显示的位置添加类似这样的内容:

    <?php 
    if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
      the_post_thumbnail();
    } 
    ?>
    

    您可以查看您的 index.php 文件以了解其设置方式,您可能只需复制并粘贴代码即可。

    【讨论】:

    • 首先,谢谢您的回答。但这似乎不起作用。也许是因为这些图像不是缩略图(因为插件)。我将代码添加到上面的问题中。
    • 如果它们不是缩略图,那么图像如何显示在主页上?这将极大地帮助弄清楚为什么它们没有出现在另一个页面上。如果这样设置,主题似乎会调用缩略图。
    • index.php中的代码:&lt;?php while ( have_posts() ) : the_post(); ?&gt; &lt;?php get_template_part( 'content', get_post_format() ); ?&gt; &lt;?php endwhile; ?&gt;
    • 对。我明白了,你说图像不是缩略图,因为插件。所以我想知道,如果您没有使用“特色图片”设置它们,那么您使用什么插件来获取主页上的图片?
    • 这是我自己编写的插件。它只是用&lt;img&gt; 标签替换标签。但是为什么它显示在主页上而不显示在类别页面上?这是相同的代码...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-04-06
    • 1970-01-01
    • 1970-01-01
    • 2014-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多