首页 > 博客相关『Blogger/WordPress』 > WordPress 正文添加标签选项

WordPress 正文添加标签选项

对于部分wp主题在正文页没有标签现实,这里提供两个简单的代码增加显示标签的功能。

1:代码比较简单就一行

1
标签: <?php the_tags(__(),,); ?>

修改single.php,放入到the_content代码之后就可以了。

2:代码比较多,放入同样的位置即可:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$posttags = get_the_tags();
$content .=[ 标签: ";
if ($posttags) {
$tag_i = 0;
foreach($posttags as $tag) {
if($tag_i > 0) { $content .= ', '; }
$content .= '<a href="' . get_tag_link($tag->term_id) . '">' .$tag->name .  '</a>';
$tag_i++;
}
}
else {
$content .=  '无';
}
content .= " ] <br>;
$content .=[ 固定链接:<a href='" . get_permalink() . "'>" . get_permalink() . "</a> ]<br/>;

原创文章,转载请注明: 转载自火星信息安全研究院

本文链接地址: WordPress 正文添加标签选项: http://www.h4ck.org.cn/2009/09/wordpress-tags-add/

  1. 还没有评论
评论提交中, 请稍候...

留言

:p 8) :lol: =( :8 ;) :(( :o: :[ :) :D :-| :-[) :bloody: :cool: :choler: :love: :oups: :aie: :beurk:
可以使用的标签: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">
Trackbacks & Pingbacks ( 0 )
  1. 还没有 trackbacks