PHP Wordpress循环,样式显示不同的帖子
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP Wordpress循环,样式显示不同的帖子相关的知识,希望对你有一定的参考价值。
<?php $my_query = new WP_Query('cat=10&showposts=4'); ?>
<?php $count = 0; ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?>
<?php $count++; ?>
<?php if ($count == 1) : ?>
<div id="featured">
<div class="span-24 last" id="details">HTML Ipsum Presents</div>
<!-- end details -->
<h2 class="clear"><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h2>
<p class="clear"><?php the_content('read more...'); ?></p>
</div>
<hr/>
<?php elseif ($count == 4) : ?>
<div class="span-8 last">
<h3><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h3>
<p class="clear"><?php the_content('read more...'); ?></p>
</div>
<?php else : ?>
<div class="span-8 border">
<h3><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h3>
<p class="clear"><?php the_content('read more...'); ?></p>
</div>
<?php endif; ?>
<?php endwhile; ?>
以上是关于PHP Wordpress循环,样式显示不同的帖子的主要内容,如果未能解决你的问题,请参考以下文章