创建标签页面,主要是为了搜索的方便,也是出于SEO的考虑。 在不同的主题使用中,总是google独立页面的制作,这次,吧教程发出来,便于参考。 1.复制你主题的page.php文件,改名为tags.php,在文件最上面添加:
2.把文件中的the_content();改为wp_tag_cloud(); 3.在后台创建标签页面。模板选Tags Cloud。 4.CSS美化 把wp_tag_cloud();改为
$html = ‘
- ’;
foreach (get_tags( array(‘number’ => 50, ‘orderby’ => ‘count’, ‘order’ => ‘DESC’, ‘hide_empty’ => false) ) as $tag){
$color = dechex(rand(0,16777215));
$tag_link = get_tag_link($tag->term_id);
$html .= “
- name} Tag’ class='{$tag->slug}’ style=’color:#{$color}’>”; $html .= “{$tag->name} ({$tag->count}) ”; } $html .= ‘
并在css文件中添加:
ul.post_tags li { display:block; width:23%; list-style:none; background:none; float:left; }
至此,完成标签页面的制作。 演示:http://love8.org/tags 基本参考:http://www.ludou.org/wordpress-create-tags-page.html
推荐站内搜索:美国服务器、google永久免费的服务器、国外服务器vps、域名备案中心、青岛ip代理、域名空间购买、网站备案系统、国内最好的虚拟主机、美国服务器、免费域名申请、