1
好的我有一个投资组合页面。每个投资组合项目都附有缩略图。我想要的是从第一篇文章中打印出第一个缩略图两次。一开始&其他在结尾处。如:image_1,image_2,image_3,image_4 &然后再image_1。如何在WordPress循环中输出两次缩略图
我的代码是:
<div class="main-interior portfolio" id="portfolio-big-pics" style="display: block;">
<?php $args = array('post_type' => 'portfolio', 'order' => 'dsc');
$loop = new WP_Query($args);
while ($loop->have_posts()) : $loop->the_post(); ?>
<?php $extraFirstClass = $loop->current_post == '0' ? ' main-image-porfolio-main' : ''; ?>
<?php
$attributes = array(
"class" => "main-image portfolio " . $extraFirstClass,
"id" => "photo_{$post->ID}",
);
the_post_thumbnail("portfolio_thumb", $attributes);
?>
<?php endwhile; ?>
<?php rewind_posts(); ?>
<div class="portfolio-box">
<h5>Portfolio</h5>
<ul class="item-list" id="portfolio-list">
<?php while ($loop->have_posts()) : $loop->the_post(); ?>
<li><a href="<?php the_permalink(); ?>" rel="<?php echo $post->ID; ?>"><?php the_title(); ?></a>
</li>
<?php endwhile; ?>
</ul>
</div>
</div>
我该怎么办呢?
不工作...我的布局brokes如果我用你的代码... –
缩略图应该是“组合框”分区之外! –
,但我从你的代码中得到了一些想法..我试试,如果我面临任何问题,我会让你知道!非常感谢你的帮助! –