到目前为止,代码运行良好,但我想在li标记内将帖子缩略图显示为背景图像。尝试了很多变化,但都没有成功?代码如下:
<div class="main-slider" class="flexslider">
<ul class="slides">
<?php
// Get all posts in \'slider\' category
$post_categories = wp_get_post_categories( $post_id );
$args = array(
\'post_type\' => array(\'Interaction\',\'Print\',\'Motion\',\'Image\',\'Sound\'),
\'numberposts\' => 6,
\'category_name\' => \'slider\'
);
$postQuery = get_posts($args);
/*query_posts(array(\'post_type\' => \'Interaction\',
\'post_type\' => \'Print\',
\'post_type\' => \'Motion\',
\'post_type\' => \'Image\',
\'post_type\' => \'Sound\'
)); */
foreach( $postQuery as $post ) : setup_postdata($post);
if ( has_post_thumbnail() ) { ?>
<li class="frontSlider"><?php the_post_thumbnail(\'feature-slider\'); ?>
<a href="<?php echo get_permalink(); ?>" title="Go to <?php echo the_title(); ?>" rel="bookmark">
<div class="flex-captionWrap">
<p class="flex-caption"><?php echo get_post(get_post_thumbnail_id())->post_excerpt; ?></p><!-- Retrieves text string from Captions field in Media -->
</div>
</a>
</li>
<?php
}
endforeach; ?>
</ul><!-- .flexslider -->
</div><!-- .flexslider -->