我正在尝试包括我在WordPress上的索引页面上的每一篇文章,并有每个人都与所包括的样式。我可以查询所有的帖子并让它们显示出来,但实际上只有第一个帖子是有样式的。其余的继承了基本的h1、h2、p和其他泛型样式,但它们并没有继承每个样式的"box“类。所有的信息都被扔到一个'box‘类中,而不是像我希望的那样,为每个帖子启动一个新的'box’类。在这方面的任何帮助都将不胜感激。
下面是我正在使用的代码
<?php get_header(); ?>
<div id="index-float-left">
<div class="box">
<?php query_posts( 'showposts=-1' ); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
<p><?php the_content(); ?></p>
<p class="post-date"><?php echo $post_date = get_the_date(); ?></p>
</div>
</div> <!-- END BOX -->
</div> <!-- FLOAT BOX BOX -->
<?php endwhile; ?>
<?php else : ?>
<h2>Not Found</h2>
<?php endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>发布于 2012-12-04 06:01:19
"End Box“和"Fload Box Box”有问题。你能这样试一下吗:
<?php get_header(); ?>
<div id="index-float-left">
<?php query_posts( 'showposts=-1' ); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="box">
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
<p><?php the_content(); ?></p>
<p class="post-date"><?php echo $post_date = get_the_date(); ?></p>
</div>
</div> <!-- END BOX -->
<?php endwhile; ?>
<?php else : ?>
<h2>Not Found</h2>
<?php endif; ?>
</div> <!-- FLOAT BOX BOX -->
<?php get_sidebar(); ?>https://stackoverflow.com/questions/13692424
复制相似问题