File: /var/www/html/wp-content/themes/mobile/index25.php
<?php get_header(); ?>
<div class="row row-offcanvas row-offcanvas-right">
<div class="col-xs-12 col-sm-9">
<div class="jumbotron">
<h1>WELCOME, MYRO PCB!</h1>
</div>
<div class="row">
<?php $sticky = get_option( 'sticky_posts' );
/* 对这些文章排序, 日期最新的在最上 */
rsort( $sticky ); /* 获取1篇最新置顶文章 */
$sticky = array_slice( $sticky, 0, 6 );
$i = 0;
foreach($sticky as $post_id):
$post = get_post($post_id);
setup_postdata($post);
if($i == 0){
$class = 'red';
}elseif($i == 1){
$class = 'bule';
}elseif($i == 2){
$class = 'bule';
}elseif($i == 3){
$class = 'hei';
}elseif($i == 4){
$class = 'hei';
}elseif($i == 5){
$class = 'hei';
}
?>
<div class="col-6 col-sm-6 col-lg-4">
<h2><?php the_title(); ?></h2>
<p><?php echo cutstr(strip_tags(get_the_content()),500); ?></p>
<p>作者: <?php the_author(); ?> 发布时间: <?php the_time(__('Y/m/d')) ?> </p>
<p>分类: <?php the_category(',') ?> <a href="<?php the_permalink(); ?>#pll-comment-here" target=_blank><?php comments_number('0个评论', '1个评论', '%个评论'); ?></a></p>
<p>标签: <?php the_tags('<span>','</span> <span>','</span>'); ?></p>
<p><a class="btn btn-default" href="<?php the_permalink() ?>" role="button">查看原文 »</a></p>
</div>
<?php $i++;endforeach; ?>
<?php if (have_posts()) :
$args = array( 'ignore_sticky_posts' => 1,//忽略sticky_posts,不置顶,但是输出置顶文章
'post__not_in' => $sticky,//排除置顶文章,不输出
'paged' => $paged
);
query_posts( $args );
while (have_posts()) : the_post(); ?>
<div class="col-6 col-sm-6 col-lg-4">
<h2><?php the_title(); ?></h2>
<p><?php echo cutstr(strip_tags(get_the_content()),500); ?></p>
<p>作者: <?php the_author(); ?> 发布时间: <?php the_time(__('Y/m/d')) ?> </p>
<p>分类: <?php the_category(',') ?> <a href="<?php the_permalink(); ?>#pll-comment-here" target=_blank><?php comments_number('0个评论', '1个评论', '%个评论'); ?></a></p>
<p>标签: <?php the_tags('<span>','</span> <span>','</span>'); ?></p>
<p><a class="btn btn-default" href="<?php the_permalink() ?>" role="button">查看原文 »</a></p>
</div>
<?php endwhile; ?><?php endif; wp_reset_query(); ?>
<div class="pages"><?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?></div>
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
<?php get_footer(); ?>