2010-12-27 1 views
0

내가 그렇게표시 발췌 한 후 이전 x 개의 루프

Category Fruit 
    Apples 
    This is a post about apples. I love apples you know they say an apple a day keeps the doctor away. Stack overflow is the Apple of my eye its a great place to Continue Reading -> 

    And a post about oranges 
    And a post about grapes 
    And a post about bananas 
+0

당신의 질문은 무엇입니까? –

+0

어디에 표시 하시겠습니까? 색인? 아카이브? 다른 곳? – ariefbayu

답변

0

아마 그것을이 할 것 해당 범주의 범주에 만든 마지막 게시물의 발췌 한 다음 이전 5 개 게시물을 표시 할 . 가장 최근의 게시물과 그 이후의 4 개의 타이틀에 대한 발췌문이 표시됩니다.

<?php global $post; 
$args = array('posts_per_page' => 5, 'offset'=> 0, 'category_name' => 'fruit'); 
$myposts = get_posts($args); 
foreach($myposts as $key=>$post) : setup_postdata($post); 
if ($key == 0) { ?> 
<a href="<?php the_permalink(); ?>"><?php the_excerpt(); ?></a> 
<?php } else { ?> 
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> 
<?php } ?> 
<?php endforeach; ?> 

사용자의 요구에 적응하는 방법에 대해 물어 주시기 바랍니다 =)

관련 문제