2013-05-30 105 views
0

我在WordPress上使用“bones”主题。在我的博客页面上,我试图通过3列显示9篇博客文章,但在第一页上有10篇博文(第一篇(最近))被放大以涵盖所有3列。在第一页显示10条博客文章,之后再显示9条博客

什么是在第一页显示10个帖子和之后显示10个帖子而不会搞乱分页的最佳方式?

这里是我的代码:(我删除了所有的HTML和,因为我认为这是没有必要的不算什么 - )

<?php if (have_posts()) : ?> 
<?php $post = $posts[0]; $c=0;?> 
<?php while (have_posts()) : the_post(); ?> 

<?php $c++; 
    if(!$paged && $c == 1){ 
     //code for the first post 
    } else { // THE REST: begin the code for the remainder of the posts ?> 

<?php } 
endif; ?> 
<?php endwhile; ?> 

回答

0

我还没有真正用它尝试,因为我没有翻页功能集up - but try this

<?php 
$post = $posts[0]; $c=0; 
$c++; if(!$paged && $c == 1){ 
$query1 = new WP_Query(array ('posts_per_page' => 1)); 
if ($query1-> have_posts()) : while ($query1-> have_posts()) : $query1-> the_post(); ?> 
<?php the_title(); ?> 
<?php endwhile; endif; wp_reset_query();} 
else{ 
$query2 = new WP_Query(array ('posts_per_page' => 9, 'offset' => 1)); 
if ($query2-> have_posts()) : while ($query2-> have_posts()) : $query2-> the_post(); ?> 
<?php the_title(); ?> 
<?php endwhile; endif; wp_reset_query(); }?> 
相关问题