Index.php
有循环,我每隔一段时间添加HTML,但当我预览帖子列表页面时,顺序不正确。我尝试了不同的循环,我也尝试了query_posts
&;没有,但没有什么可以改变邮政订单。
您可以看到链接here.
以下是index.php
:
<main id="main" class="site-main row" role="main">
<?php $i = 0;
$posts = query_posts( $query_string . \'&orderby=post_date&order=desc\' );
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
if ( $i == 0 ) {
echo "<h1 class=\'col-md-12 section-title large-title\'><span>Newest Article</span></h1>";
} else if ( $i == 1 ) {
echo "<h1 class=\'col-md-12 section-title medium-title\'><span>Recent Articles</span></h1>";
} else if ( $i == 3 ) {
echo "<h1 class=\'col-md-12 section-title small-title\'><span>Older Articles</span></h1>";
} ?>
<div class="post <?php if ( $i == 0 ) { ?> col-md-12 large-post<?php }
else if ( $i < 3 ) { ?> medium-post col-md-6 <?php }
else { ?> col-md-4 small-post<?php }
?> post<?php echo $i; ?>"><div class="post-inner">
<div class="info"><div class="info-inner">
<h1><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h1>
<div class="blog-post">
<?php if ( $i < 3 ) {
the_excerpt();
} ?>
</div>
</div></div>
</div></div>
<?php $i++;
endwhile;
else :
get_template_part( \'no-results\', \'index\' );
endif; ?>
</main>