特定のタグを持つ記事(またはページ)をリスト表示したい

下記のような感じ。(「tagname」のところはタグの名前を入れる)

<ul>
<?php
query_posts('tag="tagname"');
if(have_posts()) :
 while(have_posts()) :
 the_post();
 echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
 endwhile;
endif;
wp_reset_query();
?>
</ul>

固定ページにもタグを使用したい場合は、SimpleTagsを使うのが良さそうです。

>お仕事中の気分転換にこちらもどうぞ。

5月 10, 2011 | No Comments

Comments

Leave a Reply