【问题标题】:Featured image not appearing in sidebar on blog page特色图片未出现在博客页面的侧边栏中
【发布时间】:2011-10-14 15:10:22
【问题描述】:

我正在处理的网站上的页面有问题。我在所有页面(即关于我们、我们做什么等)上将特色图片设置为侧边栏的一部分,但是该图片未显示在以博客文章为特色的页面上。以下是博客模板页面的代码:

<?php
/**
* Template Name: Blog page
* 
* @package WordPress
* @subpackage SPS
*/
?>

<?php get_header(); ?>

    <div id="firstSection">
    <?php query_posts('post_type=post'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <h1 class="blog-title"><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></h1>
    <div class="meta"><?php _e('Posted'); ?>&nbsp;<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
    <?php the_date('','',''); ?></a>&nbsp;<?php _e('by'); ?>&nbsp;<?php the_author(); ?>.&nbsp;
    <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
    <span class="edit-link"><?php edit_post_link(__('[Edit]')); ?></span>
</div>
<div>
    <p class="blog-text"><?php the_excerpt(__('(more...)')); ?></p>
</div>
    <?php endwhile; ?>
    <?php else: ?>
<p>Sorry, no posts matched your criteria.</p>
        <?php endif; ?>
    <?php posts_nav_link(); ?>
    </div>

<?php get_sidebar(); ?>     
<?php get_footer(); ?>

我是否忽略了代码中的某些内容,或者我是否以错误的方式处理它?任何帮助将不胜感激。

问候, 达洛吉

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    您没有在您发布的代码中的任何地方调用缩略图函数。我通常用 the_post_thumbnail() 来做。您是否阅读过有关这样做的法典: http://codex.wordpress.org/Function_Reference/the_post_thumbnail

    【讨论】:

      猜你喜欢
      • 2017-08-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-02
      • 2016-01-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多