Wordpress循环,我做错了什么

时间:2011-07-28 19:43:00

标签: php wordpress

好的,我刚刚开始编写wordpress主题的基础知识,我的循环问题。它基本上只是说博客作为帖子的标题,它说的是我安装wordpress作为帖子日期的日期,并且有2个帖子,但它只显示一个。这太奇怪了。这可能只是一个我无法看到的愚蠢错误,但任何想法?

链接http://creativerxawards.com/dudnyk/blog/

和代码......

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                  
<div class = "blog_post_left">
<div class = "blog_date_head">
<span class = "b_date"><?php the_date(); ?></span> <span class = "b_author"><?php the_author(); ?></span>   
</div>
<div class = "img_hold_blog">
<div class = "img_hold_m">
</div>
<div class = "img_hold_r">
</div>
<div class = "img_hold_b">
</div>

</div>
<div class = "blog_content">
<h2 class = "blog_title"><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<div class = "button_contain"><a href="javascript:;"><img src="<?php bloginfo('template_url'); ?>/images/b_mail.png"></a><a href="javascript:;"><img src="<?php bloginfo('template_url'); ?>/images/b_fbook.png"></a><a href="javascript:;"><img src="<?php bloginfo('template_url'); ?>/images/b_twitter.png"></a><a href="javascript:;"><img src="<?php bloginfo('template_url'); ?>/images/b_lin.png"></a>
<a href="javascript:;"><img src="<?php bloginfo('template_url'); ?>/images/b_nl.png" class = "n_buttons"></a>
<a href="javascript:;"><img src="<?php bloginfo('template_url'); ?>/images/b_fs.png" class = "n_buttons"></a>
<a href="javascript:;"><img src="<?php bloginfo('template_url'); ?>/images/b_pp.png" class = "n_buttons"></a>
</div>

</div>
</div>
   <?php endwhile; ?>
     <?php endif; ?>

1 个答案:

答案 0 :(得分:3)

这可能是两件事中的一件。您实际上没有任何帖子,或者,如果它不是像index.php这样的标准页面,则表示查询未正确设置。如果是这种情况,那么您需要在尝试循环发布帖子之前设置查询。一个非常基本的将是:

query_posts('posts_per_page=10');

要了解有关该功能的更多信息,请在此处查看codex:http://codex.wordpress.org/Function_Reference/query_posts