我正在尝试编写一个查询帖子,以便它返回一个类别中帖子的固定列表,以及与之关联的任何一个标记。对于eg:
<?php $arg = array(\'cat\' => \'1\',\'showposts\' => 10,\'offset\' => 0); query_posts($arg); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<a class="post-link" title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php $posttags = get_the_tags(); $count=0; if ($posttags) { foreach($posttags as $tag) { $tag_link = get_tag_link($tag->term_id); $count++; if ($count == 1)
{ echo \'<a class="tag-link" href="\'.get_tag_link($tag->term_id).\'">#\'.$tag->name.\'</a>\'; } } } ?>
主题A中的帖子我不想看到这篇文章,因为Tag2已经显示出来了。问题是我只想显示带有唯一标签的帖子。。。。我该怎么做。。。请帮忙