1) 首先去http://vapourtrails.ca/wp-keywords下载最新的Jeromes Keywords。按照正常步骤解压缩至wp-content/plugins/目录下,并去管理区激活。然后根据提示,去wp-content/theme/default/index.php修改那个著名的Loop循环,在显示Post的段落后面加上
<div class="tag">
Tags: <?php the_post_keytags(); ?>
</div>
2) 可以根据需要自己在Style.CSS定义tag的属性,这是我的格式
.tag {
font: Arial, Tahoma, 黑体;
font-weight: bold;
}
.tag a {
background: Silver;
font-weight: bold;
color: #FA8072;
text-decoration: none;
padding-right: 3%;
padding-left: 3%;
padding-bottom: 3px;
padding-top: 3px;
}
.tag a:hover {
background: #71FAC5;
font-weight: bold;
color: #FA8072;
text-decoration: none;
}
肯定有很多冗余的地方,不过来不及仔细研究CSS语法了,以后再说吧。
3) 创建tags.php
我是从search.php改过来的,把其中search的部分换调,改为:
<h2 class="pagetitle">All posts tagged with: <?php the_search_keytag(); ?></h2>
就可以了,余下的显示post的语句仍旧保留,至于是显示标题,全文,还是摘要,只要选择是否要the_content(),或是the_excerpt()就可以了。
经过一个简单测试, 由于在/include/post_function.php中改过显示属性,所以即使Private的文章带有tag属性,在tag.php中也不会随便显示出来,应该是比较安全的。
这样在主页上点取Tag,可以把相关Tag的文章都搜索出来,不过应该不包括Page的内容(search.php也不从Page里找东西)
通过这个方式,就可以从另外一个维度组织文章,便于思路的整理。