【发布时间】:2015-01-15 02:04:31
【问题描述】:
我希望我的代码能够删除第一个查询中显示的帖子,并在上面显示的帖子之后显示 3 个最近的帖子。
热门帖子:
<?php query_posts('posts_per_page=1'); if (have_posts()) : while (have_posts()) : the_post();?>
<h2><?php the_title(); ?></h2>
<div class="news-feat-img">
<a href="<?php the_permalink(); ?>" ><?php the_post_thumbnail('indexsavedimage'); ?></a>
</div>
<?php the_excerpt(); ?>
<?php endwhile; endif; wp_reset_query();?>
最近的帖子:
</a><div class="clearboth"></div>
<div class="borderline"></div>
<?php query_posts('posts_per_page=3'); if (have_posts()) : while (have_posts()) : the_post();?>
<!-- Older news articles -->
<div class="news-posts">
<div class="news-thumb-wrap">
<div class="news-thumb">
<a href="<?php the_permalink(); ?>" ><?php the_post_thumbnail('newsimages'); ?></a>
</div>
</div>
<!-- Truncate long titles to stop the layout from messing up! -->
<a class="title" href="<?php the_permalink(); ?>">
<strong><?php the_title(); ?></strong>
</a>
<div class="clearboth"></div>
<?php the_excerpt(); ?>
<div class="news-action">
<span class="label"><?php the_category( ', ' ); ?></span>
<a href="<?php the_permalink(); ?>" ><span class="label"><i class="icon-share icon-white"></i> </span></a>
</div>
</div>
<?php endwhile; endif; wp_reset_query();?>
【问题讨论】:
-
那么,您想获取第一个热门帖子 (3) 并以特定样式显示第一个帖子,然后再以不同样式显示其他 2 个帖子?抱歉,看错了。
-
@phatskat 您看到顶部非常大,并且也显示在底部吗?我想从底部删除该帖子,并在该帖子之后显示三个最近的帖子。