<div class="content" style="min-height:1022px;">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="singlepost">
<h1 class="page-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </h1>
<div class="post_info">
<p><?php the_time('Y年n月j日') ?>
<span>/ </span>
<?php comments_popup_link('0 comment', '1 comment', '% comments', '', 'closed'); ?>
<span>/ </span>
<?php the_category(', ') ?>
</p>
</div>
<div class="post1">
<div class="post1text">
<!-- Post Content -->
<?php the_content(); ?>
</div>
</div>
<p class="clearfix" style="margin-left:20px;"><?php previous_posts_link('<< TheNewer', 0); ?> <span class="float right"><?php next_posts_link('ThePast >>', 0); ?></span></p>
</div>
<?php endwhile; else : ?>
<?php endif; ?>
<div class="cleared"></div>
</div>
上面的代码是我的单曲.php它显示内容,但它显示每个页面相同的内容,那么,它有什么问题?是循环吗?非常感谢~
一旦您了解了基本的模板选择层次结构,就很容易了,这应该可以帮助您入门。http://codex.wordpress.org/Template_Hierarchy
您还可以创建页面模板,它真的非常简单有用。http://codex.wordpress.org/Pages#Creating_your_own_Page_Templates
最后,一旦你完成了所有这些工作,你就可以开始用条件标签做一些非常聪明的事情了。http://codex.wordpress.org/Conditional_Tags
而不是你的代码,尝试这个简单的代码.php
<div class="content" style="min-height:1022px;">
<?php while ( have_posts() ) : the_post(); ?>
<nav id="nav-single">
<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
<span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">←</span> Previous', 'twentyeleven' ) ); ?></span>
<span class="nav-next"><?php next_post_link( '%link', __( 'Next <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?></span>
</nav><!-- #nav-single -->
<?php get_template_part( 'content', 'single' ); ?>
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>
</div>