//方法一
<?php
$tag = '阿里巴巴淘小铺'; //标签名
$args=array(
// 'tag' => $tag,
'cat' => 13,
'showposts'=>5, //输出的文章数量
'caller_get_posts'=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo '5篇指定标签文章输出:';
while ($my_query->have_posts()) : $my_query->the_post();
?>
<p>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</p>
<?php endwhile;} wp_reset_query(); ?>
//方法二
<?php
query_posts('cat=13&posts_per_page=4');
while(have_posts()): the_post();
?>
<li><a href="<?php the_permalink(); ?>" target="_blank"><?php the_title();?></a></li>
<?php endwhile; wp_reset_query(); ?>
标签从这里取:
分类 从这里取:
鼠标放上去就会有个