显示文章内容

2012-03-30 11:05:48

按官方的说法是:Displays the contents of the current post. This tag must be within The_Loop.
所以哩必须在循环里使用,不像神马<?php bloginfo(’name’); ?>丢里就好使。
得酱婶的:
需求:
<section class="center">
<h2>我是文章标题</h2>
<article class="entry">
我是文章内容
</article>
</section>
然后
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <!--判断是否有post,如果有请尽快出货吧,没有一会再说-->
<section class="center">
<h2><?php the_title(); ?></h2> <!--文章标题-->
<article class="entry">
<?php the_content(); ?> <!--文章内容-->
</article>
</section>
<?php endwhile; else: ?> <!--没有的话给个提示吧-->
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?> <!--循环完毕-->
|