显示三个最新帖子的摘录然后上一个x WordPress循环中的帖子数量

时间:2013-03-15 09:18:50

标签: wordpress

我想显示一个类别中最后3个帖子的摘录,然后显示该类别中之前的xyz帖子(仅限带有链接的标题)

Category news
 News One
 There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour...

 News Two
 There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour...

 News Three
 There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour...

 And a post about News 4
 And a post about News 5
 And a post about News 6....

以下是代码:

<?php /* PHOTOS CATEGORY                                                     */ ?>
<h2 class="title title-medium"><span>Photos</span></h2>
<?php
$qa = array(
    'posts_per_page' => '25',
    'tax_query' => array(       
        'relation' => 'AND',        
        array(
            'taxonomy' => CTT_PHOTO_TAG,
            'field' => 'id',
            'terms' => $photo_tag_id    
            ),
        array(
            'taxonomy' => 'category',
            'field' => 'id',
            'terms' => 1058
        )),
    );
$q = new WP_Query($qa);
while($q->have_posts()) : $q->the_post();
?>
<div>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
</div>
<?php 
endwhile;
?>

0 个答案:

没有答案