【发布时间】:2011-08-15 10:52:43
【问题描述】:
说到 Wordpess,我是个菜鸟;我最近才开始构建主题,但我遇到了墙。我正在尝试使用 wpquery 在我的网站顶部展示 3 篇不同的文章,但出于某种原因,它只显示了一篇。我将在下面包含我的代码,如果有人能帮助我找出问题所在,我将不胜感激!
pastebin 中包含的代码:http://pastebin.com/1DB7vent
<div class="site_width">
<ul>
<?php
$args = array( 'tag' => 'featured', 'posts_per_page' => '3' );
$recent_posts = wp_get_recent_posts( $args );
?>
<li>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="nofollow">
<?php the_post_thumbnail('featured', array( 'title' => '' )); ?>
</a>
<label>
<a href="<?php the_permalink(); ?>" rel="bookmark">
<?php the_title(); ?>
</a>
</label>
</li>
<?php wp_reset_query(); ?>
</ul>
</div>
我希望“li”再重复 2 次,总共重复 3 次。我正在尝试进行类似的设置:
<div class="site_width">
<li>
<a href="feat.article1.permalink" title="feat.article1.title">
<img src="feat.article1.featured.image">
</a>
<label>
<a href="feat.article1.permalink" title="feat.article1.title">
"Featured Article 1 Title"
</a>
</label>
</li>
<REPEAT 'LI' ABOVE TWICE MORE BELOW>
</div>
【问题讨论】:
标签: wordpress function loops themes