我试图在循环外显示帖子缩略图。原因是我希望在自定义页面模板中显示特征图像,该模板将为设置自定义页面模板的特定页面设置标题图像。
我试过显而易见的the_post_thumbnail();
正如所料,它没有起作用。在循环之外使用特色图像的最佳解决方案是什么?
我正在使用的自定义页面模板代码。。。
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<div class="home-header-image">
<?php IMAGE WILL GO HERE ?>
</div>
<div class="top_items_container">
<?php if (!function_exists(\'dynamic_sidebar\') || !dynamic_sidebar(\'Home Top Content\')) :
endif; ?>
</div><!-- .top_items_container -->
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( \'before\' => \'<div class="page-links"><span class="page-links-title">\' . __( \'Pages:\', \'twentythirteen\' ) . \'</span>\', \'after\' => \'</div>\', \'link_before\' => \'<span>\', \'link_after\' => \'</span>\' ) ); ?>
</div><!-- .entry-content -->
<footer class="entry-meta">
<?php edit_post_link( __( \'Edit\', \'twentythirteen\' ), \'<span class="edit-link">\', \'</span>\' ); ?>
</footer><!-- .entry-meta -->
</article><!-- #post -->
<?php comments_template(); ?>
</div><!-- #content -->
</div><!-- #primary -->